It would also be a good idea to get her ears checked out both for an infection and also her hearing, children will often bang a part of their body that is hurting , equally if there is any hearing problem ..ditto... I agree some frustration may cause her to seek attention in this way , it can become a habit, I am fairly certain they do out grow it but its scary to see ,my daughter did this at night she would wake up in the night and bang her head till we played games with her at 3am so she wouldnt bash her head.... for some reason it didnt last long, I made sure she was tired at bed time and I padded her crib ...
Thank you this was very informative
It could be that she's frustrated or it could be a sensory-seeking behavior....some children who have overactive sensory development (or underactive) do these sort of things in order to get a physical "fix"....it's fairly normal and often outgrown, but I know a "sensory headbanger" who went on to become obsessive to the point where she would constantly knock her hand on her head during the day and bang her head lightly on her headboard at night to soothe herself to sleep...well into her adult life. So it may be worth asking her pediatrician if she continues it over the next few months because I believe there are certain exercises you can use to help her re-direct sensory seeking behavior....but if it's just frustration/a phase she'll outgrow it in a few months...so I would wait and see what happens :).
It sounds like she is getting frustrated.