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 automatically 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. This means that first, the ship will try to use the highway method to get away, and if that fails, will try the docking method next until it has reached method number 5. If method number 5 also fails to evade the enemy the fleeing ship 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 to 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 normal operations are resumed. Otherwise after some time, the captain will recheck if he is safe. If the attacker is still in range after checking three times, the captain will risk resuming normal behaviour.
A captain will recall subordinates and wait for them before attempting to dock.
3 - Boost
If no L ship , XL ship or station is in the fleeing ships flight path, the ship will attempt to fly away 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 - Manoeuvre
This behaviour won't be used by L or XL ships. Instead they will try the next method. 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.