Staying together for the kids and living in a dysfunctional relationship creates a perception that that kind of relationship is 'ok' or 'normal', which doesn't help when the kids grow up & start their own relationships (trust me!).
I can't imagine staying in a unhappy situation, just for the kids. I would rather be a happy single Mum that my kids could be proud of. In saying that, I would do my damnedest to ensure I could maintain an amicable relationship with the father for shared custody.