Pets shake their heads for several reasons. The most common reason for head shaking in dogs is the one we all know - the head and coat shake after a swim at the beach or a bath. Regular or continuous head shaking in cats or dogs without reason is not normal and could be an ear issue.
Reasons for Shaking
There are quite a few reasons, and most of them relate in some way to the ears. 
* Grass seed or other foreign body lodged within the ear canal.
* Ear infection.
* Allergies.
* Fly bites on the tips of the ears.
* Immune mediated disease.
* Polyps/masses within the ear canal.
If left untreated permanent ear damage can occur including a ruptured eardrum or even hearing loss. Problems such as Aural Haematomas can develop as a result of persistent or aggressive head shaking. Any chronic inflammatory process (such as a bad infection) not treated is painful. If you have ever had a bad ear ache, you will no doubt remember the associated pain you felt before treatment.
In the case of dogs, after the sense of smell, a dog's ability to hear is the next most important of its special senses. So investigating why a pet is shaking their head and treating any problems is vital to your pet's future quality of life.