The wisdom of knowing when to fight and when to flee in a role-playing game is of paramount importance in those games that eschew the concept of "balanced" encounters, and of this matter I am in complete agreement. It is an elementary aspect of strategy that is as true in a game as it is in fiction or life. Why, I must ask, do those very same games then punish player characters for availing themselves of this legitimate tactic? Let us examine their ways. First, the Advanced Dungeons & Dragons Dungeon Masters Guide (p. 70) has this to say:
At such time as any creature decides, it can break off the engagement and flee the mêlée. To do so, however, allows the opponent a free attack or attack routine. This attack is calculated as if it were a rear attack upon a stunned opponent. When this attack is completed, the retiring/fleeing party may move away at full movement rate, and unless the opponent pursues and is able to move at a higher rate of speed, the melee is ended and the situation becomes one of encounter avoidance.
From the 1980 Dungeons & Dragons Basic Set (p. B25), we are given this version:
RETREAT: Any movement backwards at more than 1/2 the normal movement rate is a retreat. If a creature tries to retreat, the opponent may add +2 to all "to hit" rolls, and the defender is not allowed to make a return attack. In addition to the bonus on "to hit" rolls, the attacks are further adjusted by using the defender's Armor Class without a shield. (Any attacks from behind are adjusted in the same manner.)
From the 5th printing of the Dungeon Crawl Classics RPG (p. 95), we are given this version:
Once a character is engaged in mêlée, he cannot back away without opening himself to attack. If a character or monster withdraws from an active melee whether to retreat, move to a new position, or attempt some action his opponents immediately receive a single free attack.
Granted, there is a distinction to be made between retreating from combat versus choosing not to engage in it in the first place, but I would suggest that breaking off from a fight ought to have only two possible negative consequences: either the opponent will pursue or the opponent will attack with a ranged weapon (and the character in flight will have no ability to dodge, parry, or block such an attack). No special rules are needed. Combatant A chooses to retreat. Combatant B, when her turn comes up, may choose to give chase and make a mêlée attack if and when she is close enough, or make a ranged attack where she stands. It's a natural result that requires no intervention.
What is served by ignoring the rules above? Besides not having to commit them to memory, it preserves a viable tactic that one can see in fiction and reality. Sometimes combatants retreat. Not every fight is to the death. The rules as written would have you believe otherwise, however, as combatants are forced to consider opening themselves to attack in order to avoid attacks.
And how exactly does one achieve this seemingly magical "free attack" when an opponent is literally moving out of range of close combat? All it does is enforce static and therefore unrealistic and boring fights. And none of us wants that.
So, in summary, my house rule on free attacks against retreating combatants is that there are no free attacks against retreating combatants. Follow the normal flow of action.