I'm pretty damn accustomed to most of the things I want or plan not working out. Enough to the point where failure is the expected default, and good things are a genuine surprise. Can't say I do much of anything to cope, and I can't answer why I keep trying in spite of things. I just do.Prepare for the worst, hope for the best. After while enduring things gets easier as you build up resilience. But I also wouldn't consider myself the best person to ask.
I got extraordinarily lucky when my sociopathic ex tried to get me fired on a false accusation of harassment. Not only did the company find her accusation entirely baseless and told her to never to make up a lie like that again, but she ended up losing her most dreamed position/location to me in the end afterwards. Had she gotten away with it though, and had I lost my job, I have several thousand dollars in savings in the case of unexpected unemployment and have various levels of backup plans laid out in case one of those things don't work out. It would be a major setback to my overall plans but I figured if things just keeping failing for me, so long as I can get an overnight security guard position at some retirement home I'd be okay. Sure I'd lose all my ambitious goals, but if I'm failing constantly, I'm probably not cut out for that anyways.