You're very wise to notice these symptoms. Chickens do tell us when they're in pain, and they often point directly to where it hurts by scratching it with their foot. Head shaking is also a symptom of ear problems. So is balance issues.
Two things you can to do to treat this. One is to trim away the fluff so you can flip back the ear flap and clean out the ear. It very likely will have crusty pus deposits that have to come out first. Q-tips are too big, so what I've done in the past is to take a toothpick and dull one end on some sandpaper. Be sure it's nice and round, no sharpness. Then use it to pull out the crust from the ear. Chicken ears have delicate ear drums close to the ear opening so don't go beyond what you can see of the ear canal.
If you can't seem to get all the crust out, you may need to flush it with peroxide just the initial cleaning.
One of the easiest things would be to squirt some Neosporin into the ear after it's cleaned out. You would need to reapply this each day after cleaning out any more crust that develops. I would do this for a full week, regardless of any signs of improvement.
This might be enough to treat the infection, but he might need an oral antibiotic if he doesn't show improvement after a couple of days. You can get amoxicillin here just in case.
https://www.kvsupply.com/item/aqua-zole-250mg-tablets-60-count/P06186/ If he's one of the smaller Silky versions, probably
half of a 250mg dose per day for ten days would be about right.