An athlete is hit hard in a game and is momentarily stunned. The coach says "shake it off;" he does, literally, either by wriggling the affected body part or by shaking his head to clear the cobwebs. Likewise, when the play between two dogs gets a little rough, first one dog, and then invariably the other in an interesting act of syncopation, stop what they're doing and shake themselves off just as if they were drying off after a swim.
At first this behavior and explanation of same seems straightforward enough, the rapid movement of muscles gets warm blood flowing into the affected area while simultaneously distracting us from the pain, and of course, post-swim, a dog wants to be rid of the heavy sheet of water enveloping his body. But that's not the whole story either because dogs do this even when there isn't actual physical contact with another, or sometimes after a tentative first sniff of another individual. In other words it has a social, emotional component hence the phenomenon of syncopated shaking.
Consider conducting the following experiment (but only if you know your dog is okay with it). Approach your dog and give him a great big hug, pressing your cheek close to his head. Disengage and observe his response. Especially when a dog is indoors and can't deflect himself by doing something else, many dogs will shake themselves off just as if they've received a bop on the nose or have pulled themselves out of the water. Why?
Human beings don't shake themselves off but there nonetheless is a discernible feeling of compression in the experience and which is why an unsolicited hug can be an uncomfortable experience even though we all know the world could use a lot more hugs. However since dogs don't process love on the mental stage, as human beings are capable of doing which means we have verbal means and intellectual constructs to deal with compression, dogs tend to respond quite differently and so you will probably see your dog step away and then shake off the hug.
The clue to the significance of the shake-it-off reflex can be found in another oft-heard coaches' bromide when an athlete comes up lame: "walk-it-off." Emotion is energy-in-motion, and it piggybacks on the motor systems of locomotion. This is why the more emotion we have, the more we want to move. And as energy, emotion has an internal dynamic of movement that works quite like the tides in that there is a rising and an ebbing effect to any emotional experience. When emotion sweeps over us, we can feel it surge as if we're a tidal basin being flooded with the incoming tides, and then these effects slowly subside and can linger for a very long time as the waters recede. So in the animal mind, when there is an input of affection that falls outside this natural rhythm, the canine mind doesn't process it as love, but as a physical pressure, as a force which is knocking it off balance and which to a dog is equivalent to pain since in my theory the emotional circuitry piggybacks on the most basic systems of physiology. Hence the dog shakes off any energy that it can't convert into forward motion, that's the thermodynamic basis of the behavior, and which from the body/mind's point of view is equivalent to physical pain as social pressure is registered as tension at the top of the shoulder blades.
From the Psychology Today Blog of Michael J. Formica:
"A recently published study suggests that intense feelings of social rejection are experienced in much the same way as physical pain. The study showed that the regions of our brain
activated by physical pain are similarly activated when we are confronted with an intense experience of social rejection."
"The findings show that powerfully inducing feelings of social rejection activate regions of the brain also involved in the sensation of physical pain, while those same brain regions are rarely activated in neuroimaging studies of emotion. Kross remarks that this is consistent with the idea that the experience of social rejection -- or, more generally speaking, social loss -- appears to represent a distinct emotional experience uniquely related to physical pain."
When we watch dogs shaking in slow motion we can see that the action begins with the head, and then the forequarters in particular form a platform from which the shoulders can leverage the momentum and amplify the force traveling down the spine to the hind end.
The shoulders are also what leverage the force of the hind end's propulsive power during locomotion, and rolling on the ground rub-a-dub style grinding the shoulder blades into the dirt, helps to neutralize that feeling of muscle tension engendered by the perception of resistance to a state of attraction. So when dogs stop in play to shake it off, they're doing an upright rub-a-dub to remediate the social compression they're experiencing. Thermodynamically, mental pressure derives from an interruption or impingement of the locomotive impulse, be it real, or be it emotionally "mapped" onto another being.
And the best way to deal with the "pain" of social rejection? Do what dogs do, shake it off and keep on moving. So my advice to dog owners wondering how to show affection to their dogs if hugging and kissing can be construed by a dog as social pressure---is to do onto their dog what they would pay for a masseuse to do onto them. A good massage is performed quietly and with a deep, kneading action that is calming rather than stimulating. If the masseuse patted our heads, scratched our sides, hugged us head to head and chatted up a storm, I daresay there's goes the tip. We just want them to dim the lights, put on some wind chime or crystal music and get busy loosening those muscles. So to give a dog love, nothing beats a good rub-a-dub given slowly and deeply and not too many dogs will shake off such an act of random kindness.