know when to fold 'em

Etymology
An allusion to a poker player knowing when to cut their losses rather than continue in an unfavorable situation.

Verb

 * 1)  To exercise sound judgment in a situation that is precarious and uncertain.