I think all new puppy owners have experienced the following at some point. They are showing off their new dog to their friends, perhaps trying to get him to do trick, etc. However, the puppy has other ideas and starts to try and bump and grind anyone and anything in sight. Why do puppies do this, and can anything is done about it?
There are actually two opposing views on this subject. The more conventional view is that puppy humping is a demonstration of dominance behavior. All dogs are pack animals, and your puppy is simply trying to determine their place within your family pack. If you observe puppies in a litter, it is not uncommon to see the males attempt to mount their litter mates whenever possible. Female puppies can also exhibit this behavior, although it is not as common.
To those dog experts that subscribe to the dominance theory, the general consensus is that if the puppy humping is not harming anyone, do nothing. Given enough time, it will resolve itself on its own when your puppy understands his social standing (in your family, this should be at the very bottom). However, if it is still causing problems, you and other family members will have to demonstrate your dominant position by using "Sit" and "Stay" commands whenever your puppy starts to mount someone.
If you do this for 2 months, and it is still an issue, you may want to consult a professional animal behaviorist. He may recommend having your dog neutered (if it isn't already), or a comprehensive behavior management program may be in order.
A newer view of the phenomena of puppy humping is that is has nothing to do with pack behavior or dominance at all. Rather, the only thing it indicates is that your puppy is in an excited state, and is looking for a way to release that energy. The puppy humping you see is simply a motor pattern that your dog performs when in this state.
This concept rose from ideas on dog psychology. Dogs do not think like people. They live in the present, and can use past experience. However, dogs cannot comprehend how a present action will affect future events. So, in this view, they can use past experience to realize that puppy humping felt good in the past, and will feel good now. They cannot comprehend that humping another dog today will somehow affect his social standing in the future. This is beyond his understanding.
In the end, almost all dogs will exhibit signs of puppy humping at some point. Although embarrassing, it is not really a problem so long as your dog is not hurting anyone. If you feel this behavior must be curtailed, using the basic commands, as well as the crate, should do the trick. Good Luck!