AttacksOfOpportunity
From Wiki.ADnD.com
This is a melee attack action that can be taken by someone who has an opponent make an undefendable action. Casting spells, grappling or doing something that frees the hand of a weapon are the most prevalent causes of being open to Attacks of Opportunity (AoO).
These are considered a good part of the modern rules. Playing a strategy game where the opponents can freely run around you to attack somebody in your support group can show the need for AoO to impose some reality in a combat situation. It is tricky at first to learn what actions impose AoO and which ones do not, but it is a fine point that is quickly learned.
The only problem with AoO is the official ruling that they should be incurred on the space you move FROM and not INTO. This is to penalize those that desire to leave combat (as if staying and dying should be a wise decision), especially mages who desire to safely get off a spell. This ruling however contradicts other rulings (like, the AoO definition of moving from a threatened space INTO a threatened space). Attacks of Opportunity should be considered to take place upon the space moved INTO and not FROM. Truthfully, this is a position that was considered supported by the 3.0 D&D rules, although later clarifications stated otherwise. This ruling does allow one to step away from normal combatant rather easily, but such is actually true for real confrontations (Hey, SCA, all those presentations did win you one convert). Note that this interpretation has raised the request for a feat called Press.
How AOO works
If you read page 122 of the 3.0 Players handbook under Attacks of Opportunity you'll see how AOO works
Provoking an Attack of Opportunity
"If you move within or out of a threaten area, you USUALLY provoke an attack of opportunity. If all you do is MOVE(not RUN) during your turn, the space that you started out in is NOT considered threatened, and therefore enemies do not gain AOO against you when you move from that space."
what this mean is that a person can move there base movement away from a mob, also since you did not attack, you can take a 5ft step before your movement(remember the round is in 2 parts), this will allow you to do a full run to get away from an enemy.
also walking up to a mob DOES NOT provoke an AOO because the mob is considered adjacent to you(page 123 PHB under Melee Attacks), only running up to a mob will provoke an AOO, the only exemption is doing a charge(page 124 PHB). If the mob has a 10ft(or larger) reach because of a weapon or size, moving beyond the 1st 5ft will provoke an AOO.



