Generally, the AI will prioritize not dying over following commands. When ships feel safe/not threatened they follow commands well, but when they are being attacked/harassed, they focus on that instead. Speed is a really important factor here though. Fast ships are much better at following commands because they can back off from the enemy easily. Once they are out of weapons range, then they will happily follow orders. Slow ships will not be able to back off so they often are perpetually stuck engaging a few ships and they can never get disengaged enough to follow orders. Usually when I tell a ship to run away and it doesn't, it is because it is trying to run away but is not fast enough.
There are a few exceptions though. Eliminate and Avoid seem to take the highest priority.
Eliminate is often too effective, ships will suicide into the enemy to try and get the kill. I use eliminate to confirm kills on vulnerable ships, and also to force repositioning. You really need to monitor and be ready to cancel the order though, because either the enemy ship will die immediately or your ship will die charging towards it. There are no other outcomes unless you cancel. It is still the best way to make ships do what you say, but they will only do what you say and won't do anything to preserve their own life. It would be interesting if there was an eliminate level waypoint order that forced ships to go to the waypoint, but that doesn't exist right now.
Avoid is a super conservative command that mostly guarantees your ships will not die to the avoided ship, but it very much interferes with the ships ability to do other things. Only use it if you are super scared of a particular ship.