Opportunity attacks have me confused; I’m wondering why (in terms of mechanics and less so with regards to motivation) any creature would flee in a battle knowing that it could potentially be pummeled by several combatants who each use their reaction to make an opportunity attack.
Sometimes, the potential reward outweighs the risk of an opportunity attack.
This is going to be a cost/benefit analysis done on the fly in combat, and will vary wildly depending on circumstances. Let's imagine a few scenarios:
A Cleric is engaged in melee with a pair of enemies. Across the battlefield, 100 feet away to be exact, the party Wizard has been brought down by an arrow. The Wizard critically failed their first Death Saving Throw, giving them two failures. It is the Cleric's turn, and the Wizard is up next in the initiative order. The Cleric knows the Wizard is on the brink of death, so they heroically run to the Wizard to get in range of a Healing Word. The Cleric takes a couple of opportunity attacks, but by moving and taking the Dash action, they are able to get in range and cast Healing Word on the Wizard with their bonus action. The Wizard is conscious for their next turn and blast the enemies the Cleric had been fighting with a fireball, turning the tide of battle.
A Fighter is engaged in melee combat with a pair of Skeletons. The Necromancer that animated the Skeletons stands just out of reach, confident that their minions will keep the Fighter at bay. To the Necromancer's surprise, the Fighter chooses to ignore the Skeletons, shrugging off the opportunity attacks (they missed against the Fighter's high AC), and landing a death blow on the Necromancer. As the Fighter had hoped, the animated minions fall to pieces without their master's magic to sustain them.
The artifact that the campaign's main villain has been attempting to find sits on an altar at the center of a temple. Knowing that the party Sorcerer is the only one who can destroy the artifact (either for campaign-specific reasons, or because the Sorcerer is the only party member that knows the one spell that can destroy it), the villain has targeted the Sorcerer from the beginning of the fight, never leaving melee range. The Sorcerer has finally managed to get within one movement's distance of the artifact, but their hit points are running low and the villain is still in melee range. Knowing the villain will probably finish them off on their next turn anyway, the Sorcerer risks the opportunity attack to make a break for the artifact. Whether the opportunity attack hits or misses, that will be an exciting, campaign-altering moment.
I've put up some of the most dramatic examples I could think of, but essentially every player and the DM do a little cost/benefit analysis in the moment their turn begins, deciding if there's a worthwhile reason to take an opportunity attack. Often times, it's obviously not worth it. Sometimes there's clearly greater worth in getting an attack in on the main villain at the cost of an opportunity attack from a minion. Other times it's not clear cut. The more experienced you get as a player or DM, the easier it will be to make those snap decisions.
If you use the Disengage action, you don't cause opportunity attacks from any enemies during that round. Begin your turn by taking the Disengage action and then you are free to move around as you wish with nobody taking an opportunity attack against you.
They could only attack you during your movement if they had taken the Ready action to do exactly that on their last turn, which in most situations is very unlikely.
I've mainly used this in specific instances where getting somewhere on the map is more crucial than taking the swipe of damage.
An example I faced the other day: We were doing a "stealth" section with powerful Vampires patrolling the town. I got caught by one just outside of a doorway. Since vampires must be invited in, I decided that it was worth taking the opportunity attack to quickly run inside so I couldn't be attacked anymore (for the time being).
Other times have been when there's some kind of constant damage ticking in a certain portion of the map, like a gas. Might be worth to risk the attack of opportunity to run away and bring the fight to a more optimal location.
Though in a general combat scenario, I don't think there's much benefit unless you really suck at melee combat for some reason.
A mechanical reasoning behind taking an opportunity attack. To attempt an opportunity attack, the creature must use their reaction. There are many abilities and spells that rely on having a reaction to use; if that reaction was already used, it may leave the enemy open for greater attacks.
- An evil sorcerer is in melee combat with a rogue. The rogue runs from melee without disengaging to try to hide with his Bonus Action. The evil sorcerer has the War Caster feat, and casts Poison Spray on the retreating rogue, using his reaction to do so. The party’s wizard, on his turn, begins to cast Disintegrate grabbing his lodestone and dust; the sorcerer also knows this spell but doesn’t have enough time to counterspell it (he used his reaction already). The evil sorcerer is defeated and turned into a pile of dust.
Reactions are a limited resource; a player who flees from melee combat forces a decision to be made on their turn. In the example above, the wizard saw a moment of weakness brought on by the opportunity attack and unleashed his most powerful spell.