I disagree that taking a fight to the ground is bad, I myself, unless I'm against multiple opponents, almost always take a fight to the ground.
It depends on ones body type however, retards can tell you size doesn't matter, and feed you all this ancient art bull, but the fact is if your a stong enough individual you can easily gain an advantage by taking a fight to the ground.
But to headlocks, I'll have to explain the way I deal with them, and I'm a heavy guy, so if you can't do this, I'm sorry it's the only ways I know. However I'd like to add that growing up I was a small guy, I was somewhat unusually strong, but not heavy, and not tall, I still managed to pull these tactics off.
Standing up, easy, grab whoever is holding you in like a bearhug kind of hold, just wrap your arms around their torso. Once this is done, make sure your drip is firm, and just run around, force the both of you around, smash against walls or other objects (of course not headfirst or your just going to hurt yourself and soften his impact).
On the ground, well this is the only position I hate being in when a fight is on the ground, usually I try to get to my feet and keep my opponent on the ground, it's gonna hurt, and your going to be arched over face first against the ground so it'll probablly hurt, but this is when you struggle away, strike your opponent if it's a must, but generally if your halfway on your feet they will let go so they can get out of a position where you have the advantage. This is more of a phsycological tactic than a physical one.