You have to look at the body as a whole and not just head or tail because you get a better overall picture.
The main indicating factor that a dog is not happy with the situation it is in is stiff body language. Every move will look forced and rigid, even a tail wag can be rigid (eg held high and stiff with short fast movements).
The muscles around the face will also be tensed as will the shoulders and rest of the body.
Some may have visible hackles raised (ridge of fur along back). This can signal both aggression and alarm. Both situations may result in a bite.
Unless its a dog with natural bugling eyes like a boston terrier etc being able to see the whites of a dogs eyes is also usually a sign they are not happy.
Most dogs will not go straight in for a bite they will usually exhibit avoidance behaviours such as looking away, turning away.
Excessive yawning and lip licking can also be other signs of stress.
A lot of aggressive seeming dogs are what is called fear aggressive. Their every nerve is terrified so they follow attack is the best form of defence strategies. They will usually exhibit other stressed body language before going all out, growling slathering nut case. By this time however they have lost control of themselves and are running on pure terror.
A happy dog will have a relaxed looking open face (tongue lolling out of the side for example).
Have more fluid overall body movements.
The tail will be more fluid and lazy, unless they are really pleased then it will whip around their bodies 10 to the dozen and they will wag their whole bodies almost.
There are an excellent series of videos linked on here somewhere which demonstrate relaxed and stressed body language in dogs.