Space is a big and dangerous place and sometimes there are fights which cannot be won. In that case the attacked ship will attempt to flee to save the crew's life and possibly it's cargo. Fleeing can be either triggered manually by giving the flee order when an NPC asks for assistance or autoamtically in response to certain actions (see NPC Behaviours).
To evade danger different methods are used by the the player's and NPC's ship's captains. These are currently called 1 (Highway), 2 (Dock), 3 (Boost), 4 (Maneuver) and 5 (??). When attempting to flee the ship will follow a set order: 1, 2 , 3, 4, 5, which means that first, the ship will try to use the highway to get away, and if that fails, will try docking next until it has reached method number 5 in which case it will start over from the beginng. It's possible to override the current flee method by clicking on the + icon next to the flee order and changing the method property. This will abort the current attempt and instruct the ship to use the defined flee method. However if that method fails, the ship will still try flee using the next method in order.
Ships will attempt to flee a maximum of 20 km away before resuming normal operations. If the fleeing ship has laser towers and is not using the highway method it will deploy them. If the fleeing ship has wares and the flee method is not Maneuver then there is a chance that the cargo will be dropped based on Morale (?? crew, captain).
1 - Highway
The fleeing ship will look for a Highway within radar range and attempt to use it. This method can't be used by L or XL Ships since they can't use highways. They will just attempt to use the next method.
2 - Dock
This behaviour won't be used by L or XL Ships they will try the next method instead. The fleeing ship will check for any stations in the zone that are of neutral or higher relation and choose the closest one as docking target. If there are no stations then it will try the next method. When the ship is docked then it will check if the attacker is greater than 15 km away. If that's true the pre-flee behaviour is resumed. Otherwise the ship will wait for some time, after which it will recheck. If the attacker is still in range after rechecking three times, the captain will risk resuming normal behaviour.
If a ship has subordinates it will recall them before attempting to dock.
3 - Boost
If no L, XL ship or station is in the fleeing ships flight path, the ship will attempt to fly away to a resonable distance by using the boost for a maximum of 30 seconds. This will not be done if the shields of the fleeing ship are lower than 50 %. In that case the next method is tried.
4 - Maneuver
This beahviour won't be used by L or XL ships. Instead they will try to use method 4 instead. As a last resort, the captain will try to outmaneuver the attacker by flying random patterns for some time.
5 - Unknown
Seems to be the same as method 1.
Based on the Flee Behaviours Explained Guide by Rezoken.