I am actually writing a article to be published on this very topic.
A wagging tail can be most complicated in its meanings. Dog behavior is complex and signals that dogs send are often very subtle. A dog’s tail can tell us many things about their feelings. The dogs’ tail is an important method of communication and in combination with their other body language signals; are cues to help tell what our animal(s) are trying to say to us. Most people believe that a wagging tail means a happy dog.
Confidence/Fear/Dominance/
A dog's tail is just one tool that the dog uses for communicatino. The dog also uses vocalization, scents and other aspects of body language such as eye and ear movements, pupil dilation and general body positions. Therefore, the dog ha to be taken as a whole to best determine what they are saying instead of just focusing on the tail position and/or level of wagging being done.
We also have to be very careful about not 'humanizing' our dogs for while they are capable of a wide variety of feelings/emotions, they are not humans…. 😉