Another possible reason why he had a bacterial infection which irritated his nose causing him to shake his head to try and loosen it, is because something was stuck up his nose: a foreign body.
Another possible reason why he had this infection is because he may have the beginnings of cancer in his nose. That, again, would cause an obstruction and an irritation or discomfort - possibly. I am waiting to see how that develops.
In general, any irritation in the nose, in the mouth or in or on the ears might cause a cat to shake his head to try and get rid of that irritation/pain/discomfort.
Perhaps the most common reason for head shaking is ear mites simply because they are fairly common in the first place. You'll see a lot of cat owners on the Internet recommending to a person that they clean their cat's ears on the basis that their cat might have ear mites. Personally, I would not try this. It is too problematic a process. The cat might be hurt. Also, the cat might not have ear mites. There are too many ifs and buts. The only thing to do is to see a vet.
A sore and inflamed mouth can also cause a cat to shake his head.
With respect to a cat's ears, the following conditions might lead to head shaking:
- a foreign body or a tick the ear canal
- an infection of the year
- a blood clot under the skin of the ear flap (damaged ear)
- and ear that has been damaged in a fight which has become irritating/uncomfortable.
These are just examples. A veterinarian's diagnosis is required. With respect to my cat, the irritation in his nose has been at least temporarily cured through selecting an appropriate antibiotic which kills the bacteria.