While I believe that most marriages can be saved, and that partners should do everything they can to work things out there are obviously circumstances under which leaving is the wiser choice. If you're getting more pain than pleasure from your partner, do not stay in an abusive relationship - and this can apply to a number of things: physical, emotional, psychological or verbal grenades being thrown at you.
But first, as I discuss in my books Adultery the Forgivable Sin, and Make Up Don't Break Up, I believe it's important to know that you've tried everything else. You're not responsible for the other person's responses but it will give you peace of mind knowing that you've done what you can to safely and healthily make the relationship work. If it comes to that point, then it is better for your own well-being, and that of your children, to end the relationship.
Many people think that they should stay together for their children but this can have the opposite affect on children as they grow up. When children are in an environment free of contention, bitterness, and uncertainty, they can thrive. This can have a positive result not only in the short-term, but also in the long-term relational health of the child even as they grow into adulthood. A toxic environment can affect their adult relationships in terms of the partners they choose and how happy they will be - it affects their intimacy later on in life. You should never "stay together for the kids" because eventually they will grow up to have their own lives, which is why you need to claim yours now.
Additionally, your children (especially once they get to adulthood and understand such things) will want you to be happy. If they find out that you sacrificed your happiness for them, they can end up having extreme guilt and may never get over that - staying attached to you instead of being able to bond to a partner. Kids will grow up and have their own lives - they will understand that sometimes things don't work out and you have to move on.
They will respect you for standing up for yourself and setting boundaries. Studies done on children of divorced parents show that the kids did better when they were out of the hostile, bitter environment even if the parents divorced. If children stay in a toxic environment it can affect attachment later on in life, and the partner they choose when they grow up.
This isn't to say that divorce won't affect children. It will. But children are resilient and with you by their side, they can learn to cope with the circumstances. It will be hard and you will need support from others for the courage to make this decision. You have to tell yourself that you CAN do it, but remember it's more damaging living with an emotional divorce!
As a parent contemplating divorce, it's normal to feel concern toward your children, and to question leaving the relationship. Many people choose to stay and end up creating a toxic environment, and not showing their children a good role model. If you are putting yourself and your kids at risk for physical or emotional sickness by staying in a toxic environment, I give you permission to leave! It's ok to be happy!!