Why puppies do it -
Every game a puppy is playing is meant to prepare him/her for life, learning all relevant skills they might need in their later (social) life, one of it is breeding.
While puppies or young dogs can have a sexual motivation by doing so or a urge to display their status, they are not aware of it.
Humping out of sexual motive when a intake male mount a female or a neuter male.
Nothing can top the smell of a female in heat, but studies show that a neutered male is almost as attractive than a "normal" female and that males neutered in spring have more admirer than males neutered in fall. Go figure.
Humping to impress, to show off.
The other dog gets limited in space, the head or paw will be put on the shoulders, humping mostly from the side.
His behavior will only be displayed when a rival enters the picture or if a lot of (young) dogs meet and feel like they have to establish a status hierarchy.
While humping is a normal doggy behavior, it can be not only be embarrassing for us, it is also not really polite.
As long as my personal dogs are ok with humping each other during a play, I will let them be.
I will interrupt humping at the Dog Park with dogs we don't know, but usually it is already over before I call them off.
Good socialized and well mannered dogs will take care of others humping them without any escalation.
Be aware that humping out of "status" might flip into a scuffle or a fight and be careful with getting physical involved.
Don't let your dog hump people or kids.