A dog's tail is an extension of their spine, and not only do different breeds have different sizes and shapes of tails, they may use them for very different purposes.
One thing that all dogs have in common is using their tail for communication. Dogs rely heavily on body language to communicate thoughts and feelings, and their tails play a huge role in this. One of the most familiar sights is that of a dog wagging its tail. While most will do this when they see their people, it can also be a greeting or acknowledgement for a number of different things, from a dog friend to hearing a familiar voice over the phone.
Tail wagging is an interactive form of communication, and dogs will not generally wag their tails when they see something familiar that not capable of answering back. Tails wag when we take them to the park, but the communication is meant for us more than the actual park itself. The behavior is also something dogs pick up as they grow and mature; puppies younger than a month aren't capable of this form of communication, just as human babies generally don't smile at first. Puppies will first wag their tails at the same time they begin to do more than eat and sleep, and instead begin learning the principles of social interaction.
The tail is also used to signal other emotions. When the dog sees something new and interesting, they will often hold it straight out and horizontal to the ground. This indicates that right now, the new and interesting thing can go either way - if it meets with approval, the tail will generally go back to being held upright. If it meets with disapproval, the tail will often go down.
A tucked tail indicates fear or submission, and serves a practical purpose in addition to the visual indicator. Dogs have scent glands located below their tail, and by tucking it between their legs they can black most of the scents that are being released in the hopes that it will help keep them from attracting any unwanted attention.
Some breeds have their own uses for their tails. Some herding breeds, such as the Australian cattle dog, use their tails to help them steer through fast turns. The tail acts to help them balance when cutting, whether they're dodging through cattle or chasing a ball in the yard. Similarly, dogs that swim use their tails as a rudder to help them maneuver through the water. Some dogs, like huskies, have long, furry tails that they can wrap around their bodies to help keep themselves warm when they curl up in a ball to sleep.
Tail docking is a common procedure for many dogs; most of the time it is done for cosmetic reasons. However, docking a dog's tail can have some severe consequences. Studies have shown that dogs with docked tails are more likely to be in confrontations that end in aggression, because they are unable to use the most visible of signals. Other studies suggest that docking tails can cause problems later in life. The muscles that control the tail are attached to the hindquarters, and when dogs are unable to exercise these muscles by using their tails they have shown an increased risk of urinary incontinence, and degeneration of the muscles in the hindquarters.