Anytime a child gets rude with you, especially, but anyone in general, an immediate (or soon as possible) punishment should go into effect. Much of this behavior is about A) attention and B) trying to find what methods get them what they want. This is especially obvious in the 2-3 year age (hence the terrible twos), but can still continue into older ages. Or if they're a little older they may have found it to be effective so they continue it.
I realized, as an adult, that i was often very manipulative to get my way. Not always, but when i felt i needed. Because, growing up, i often felt my voice didn't count, i had to find other ways to get what i wanted. For me, it was subtlety and playing on emotions. Some learn to use anger and fits. Or other ways.
The more steady and consistent you are, and the less emotionally you respond, the less room they can find to use their version of manipulating.
If they child is young, time outs are among the most popular methods. A time out requires a child to be apart from anyone else, and to sit quietly. No talking, and do not talk to them. And if they get up, just move them back and minimize your interaction. They should already know, ahead of time, that they will not be allowed off until they sit the full X minutes properly.
As far as hitting themselves, i'm less sure of how to handle that. Often times it is just an attempt to get attention.
Some good resources, if you are able to get them there, is Boundaries With Children by Townsend/Cloud. And, it may sound silly, but a great way to learn about this stuff is look for a show called Supernanny. I believe there are English and US versions. I have learned a lot through watching her.