Ear mites are tiny little parasites that live and breed in cat and dog ear canals. They eat skin debris and can actually gnaw on the live tissue for cell fluids and blood. Ear mites cause your pet to itch, so if you notice your cat scratching his ear more often, shaking his head or angling his ears, that's a good sign he has mites. You can also check your cat's ears for black or brown waxy debris that resembles coffee grounds. If you use a magnifying glass, you may be able to see the mites moving around in there.
Once you're sure your cat has ear mites, you have to remove that brown gunk from his ears and apply a specially formulated topical insecticide into the ear canal for a predetermined length of time. The insecticide will take care of any mites still in there and any future mites that hatch in leftover eggs. To clean out the gunk, put a few drops of mineral oil in your cat's ears and massage it in. Wipe out the ears with a tissue or cotton ball. Don't use an ear swab, because if you mess up you could destroy your cat's eardrum. You can get the insecticide drops from most pet supply stores; make sure the ones you get have pyrethrins in them. Follow the directions on the package.
Chances are that you didn't spot your cat's mites until there were already thousands there. Some mites might escape the ear extermination process and hide out in your pet's fur until the slaughter is over. To eliminate that possibility, make sure you treat your cat with flea products regularly. Also, there's a chance that a few mites might survive the ear cleaning. If a survivor lays eggs, you'll be back where you started. So make sure that you treat your cat's mites every day or two for a few weeks, just like the package says.