i agree with bacchus, if your got a chance to win then stay but sometimes it is so obvious that it is just matter of when, not if, so routing your troops is advisable
nb. if any of your allies are still there then you should stay, because there still is a chance of a victory

i guess you just got to use common sense and experience