In A Nutshell
A wagging tail is a universally understood symbol for canine happiness, but in reality, tail wagging can communicate much more, including aggression, anger, and agitation. Dogs wag their tails to spread their unique scent, which can convey important messages to other dogs.
The Whole Bushel
Tail wagging serves a much larger purpose than letting humans know that a dog is happy. Each dog has its own unique scent, secreted from anal glands (thus the rear-end sniffing). Tail wagging helps to spread that scent. Alpha dogs hold their tails higher; more subordinate or frightened dogs may hold their tail between their legs to try and evade attention.
By wagging their tails, and thus spreading their scent, dogs are communicating that they want their scent to be detected. For example, a wagging tail at the sight of a friendly face or prospect of playing can signal that the dog wants to be noticed and interacted with. But tail wagging isn’t limited to being excited and happy. In fact, tail wagging must be interpreted in conjunction with other body language—which, of course, other dogs are much better at reading than we are.
Elise Christensen Bell, a veterinary behaviorist, says that when dogs wag their tails to the right, they are happy; to the left, frightened. A tail being wagged low suggests apprehension. Tail wagging in conjunction with stiff muscles, ears pinned back, or dilated pupils conveys that the dogs wants you to back off—its spreading its scent as a warning, not as an invitation.
Tail wagging is something of a learned behavior. Puppies begin wagging their tails at around a month old, when they need to communicate with litter mates in play or adults for meals. Tails also help puppies—and grown dogs—balance, which was probably their original purpose before canine communication developed.
As tails are crucial for communication between dogs, dogs without tails screw with the system. Adult tailless dogs tend to exercise caution around other dogs to ensure they don’t send the wrong signals (puppies may be more reckless). Unsurprisingly, wolves also use their tails to communicate. Wagging tails in wolves typically suggests that a wolf is relaxed.
Show Me The Proof
Animal Planet: Why Do Dogs Wag Their Tails? Part I, Part II
The Lupus Foundation: Wolf Behavior
How a Wolf Communicates through its Tail and Body Posture