How do you know when to leave a toxic relationship?

If they make a mistake and you're in a toxic relationship how do you when it's time to leave? And when you have kids.