If he is shaking his head intentionally, it may be because he has an ear infection or ear mites.
If he is not aware of shaking his head than he could be having intention tremors. Intention tremors could be a symptom of a neurological disease such as cerebellar hypoplasia, trauma to the brain, degenerative brain disorders, infectious or inflammatory disease, and more.
Please have your dog examined by a vet for this. Your vet could examine your pets ears. If your dog does not have an ear infection, your dog should probably be examined by a veterinary neurologist.
It may also be a good idea to videotape your dog when he is performing the head shaking, in case he does not demonstrate the head shaking during the office visit.
Is it an uncontrolled shake like a tremor or is it voluntary, like dogs do after you ruffle the fur on their head? If it's voluntary, check his ears for parasites or signs of infection (smelly?). If it's a little tremor, that's a different story. Either way it wouldn't hurt to have a vet take a look.