Step on the attacker's foot. Do it quickly and get it right first time. If executed correctly, you will cause them pain, which could be enough to make them loosen their grip, allowing you to get away.
Punch the upper inner thigh or groin.[11] Then pull their head up (by hair, eye sockets, whatever), and push them away from you... and run.[12]
Pinch your attacker. This method can make the attacker's face hurt, and give you enough precious moments to break out of the headlock.
Move your head up and down, fast. The aim in doing this is to confuse them; once you've done so, make a sudden forward movement. This will also cause the attacker holding you in a headlock to fall.
Grab the attacker's arms, and push your head under them, and break out. This requires finding a key moment when their hold is less or their focus has been distracted temporarily. An effective strike to the ribs or genitals may cause enough distraction.
Use two hands against one of theirs (2v1). Focus both of your hands on one of their wrists and pull it away. It is VERY difficult to apply a good headlock or choke with just one arm so once you've removed one of their arms from the clench you should feel instance relief from the pressure.
Or rather than choosing one hand, pick a finger. With one hand take hold of a finger and bend as hard as possible. This technique will break an aggressors finger with relative ease.