Well with the exception of artillery/siege units, you only withdraw from losing battles. Therefore, the withdrawal chance for normal units is (100-%win)(%withdraw). In other words, if you have a 50% chance of winning the battle, and a 20% withdraw rate, you'll withdraw from 20% of the LOSING battles, or 20% of 50% = 10%. If you have a 10% chance of winning, you'll withdraw from 20% of 90% = 18%.
Artillery/siege units, that have a maximum on the damage they can do, will withdraw (100%) when they reach that maximum, or if they lose the battle (whatever the withdrawal chance is).
Go by what shows up with you mouseover with rightclick. Chances of winning + chances of withdrawing = chances of survival.
edit: Although, I think First Strikes negate withdrawal, or in other words if you are killed by the first strikes of an enemy then you don't get a shot at withdrawing. I think this because I've managed to kill Loki outside of a city using my HN Giant Spiders, which have 1 first strike. Granted, it took something like 50 turns with 4 spiders...