In D&D 3.5 the Withdraw action is defined as follows:
Withdrawing from melee combat is a full-round action. When you withdraw, you can move up to double your speed. The square you start out in is not considered threatened by any opponent you can see, and therefore visible enemies do not get attacks of opportunity against you when you move from that square.
What I don't get is that an Attack of Opportunity is basically a free attack by your enemy because for one reason or another you let your guard down by casting a spell, or firing a ranged weapon, etc., etc. Basically you're not fully engaged in defending yourself.
How does fleeing combat not cause an Attack of Opportunity since you're basically fleeing combat?