I stayed for 17 years - made the decision when DS was 9 months old and left when he was 18. It might not have been ideal, but it did work for me because the children were unaffected.
How did I do it ? I got very involved in work, and in fact that was great for my career. I did a lot of courses and became quite senior in my workplace which I loved.
I was very involved with the children too - never too busy to go to their events, sports, etc. Always happy to take them and their friends to all-day competitions ! On my days off ( which were during the week) I volunteered at their school, becoming one of their longest-serving "reading mums" , listening to slow readers two days each week for many years.
At home I kept it cool. We lived like brother and sister, very amiable with each other but nothing more than that. We did sleep in the same bed, but since he was a very deep sleeper and fell asleep instantly , I just waited until he'd been there for half an hour and then I'd climb in and sleep peacefully.
The fact is that ex made it easy for me , he was easy to live with, a good cook, good around the house, clean and tidy . A Disney type of father, happy to take them out for a great day but fairly useless with them on a day-to-day basis. However I was so involved with them that this wasn't really a problem . The DC grew up in a home where they knew they were loved by both of us , in our own different ways.
I left when they were 18 and 22 - they were surprised but they had their own lives and they didn't take it hard. My DD was emotional about it , but I spent a lot of time with her, talking it through, and she came to terms with it . DS was like "Mum, if you're happy, that's all that matters" .
We've been divorced for 13 years now, I'm married again, ex has a long-term partner . The DC get along great with all of us, family events are friendly and amiable.
Good luck on your journey - I hope it all works out for you, whatever you decide.