I feel for you, my 22 months old son does the same, and he knows baby sign, and can talk somewhat too, and he STILL doesn it anyway, some kids just do.
I have tried putting him down if he head-butts me, and ignoring him if he is banging on the floor or whatnot in a tantrum way......he DOESN'T learn from the natural consequence of it hurting him, he just cries harder and bangs it again. It is a tantrum and a way of asking for attention or something else ( food, nap, etc.). I have tried hugging him to calm him, and sometimes that helps, and the only other thing that gets him to calm down is a time out in his room alone....he needs the quiet and space to clam himself, and his pacifier and blankie help, too.
These things calm him and get him to stop tantruming, but they don't stop him from doing it the next time. I try to get him to use his words and explain what is wrong, but once he is angry/frustrated, there is no reasoning with him. I am hoping it is just a phase and he will grow out of it.
I hope there might be some actually helpful responses form moms who have had head-bangers who have now gotten past it....other than buying them a helmet, LOL.
It is a very frustrating and worrysome behaviour for us moms. Sorry i was probably no help....I would suggest calmly picking them up and putting them in their beds/cribs for a calm-down time, and close the door and tell them they can come out when they are calmed down and ready to play nicely again....that is all I usually do to help him settle down.
Jess