It is normal for a cat to groom its head, but repeated scratching might indicate a problem. One common type of ear infections in cats is ear mites, and they could be the root of the issue.
Ear mites in cats are highly contagious, so your cat may have picked them up from another cat, according to VCA Animal Hospitals. The most common clinical signs include ear scratching and head shaking and a dark, waxy or crusty discharge from the ear. The skin around the cat's ear may also be irritated from all the scratching and hair loss in the area may occur. According to the American Society for the Prevention of Cruelty to Animals, there may also be a strong odor coming from the ear.
Bring your cat to the veterinarian if you notice these signs. The vet will be able to observe mites and rule out other causes of these clinical signs. Once the cat has been diagnosed with ear mites, it will be given medication to eliminate them. VCA recommends owners treat the ears and skin of all affected and susceptible pets in the household.