About 1/2 cc of ivomec in the ear for a day or two will usually cure it and also Bloodsworth's makes a ear mite remedy and several others do too, you can find them in Tractors Supply, by the way, if you keep Purple Python cattle tags on your dogs collars this will prevent them from ever happening again. I fought them for years until I started using the cattle tags and this has eliminated my ear mite problem and certainly tick problem too. The tags won't help after they get them but will prevent them from getting on them in the first place.
The head shaking sounds like a yeast infection. Be careful treating for ear mites if it is an infection, good way to damage ear drums. Medicine is available at local farm stores but we have had good luck with Zymox...
http://www.revivalanimal.com/Zymox-Otic.html
If its a yeast infection it will have a smell and you will see mucus down in the ear. Kayla, you are correct, mites and yeast infection both cause head shaking but again, the yeast infection will show definate signs of smell and mucus in the ear.