My rabbit had an issue with a build-up of ear wax. I had to put drops in both ears for 10 days. It was a liquid that cats and dogs would also be prescribed. If your rabbit doesn't have ear mites or any other symptoms, then this could be the cause of the head shaking. Check the ears to see if this is the issue. Also maybe something got stuck in the ear and it's trying to get it out.
Regarding the teeth grinding issue. This could mean two things. One when rabbits grind their teeth, it can be a sign of happiness. It doesn't happen often and it's hard to predict when it could occur but it does happen. Secondly, it could also be a teeth issue. Do you give your rabbit wood stick or untreated wood to chew on? Some pets stores sell wood, especially for rabbits. If rabbits don't chew wood then their back teeth next to their cheeks will grow down toward the tongue which will then require your rabbit going to the vet to get its teeth filed down under gas. This isn't a common thing and it's only when your rabbit stops eating that these things are looked at to eliminate it as the cause.
Giving your rabbit wood to chew and hard food pellets will help them with grinding down the two rows of teeth which stops this issue.