When I say “work out OK”, I mean that over the long run the positives outweigh the negatives.
Typically that would mean that it doesn’t wreck the participant’s marriage (unless that person was planning to end the marriage anyway), relationship with children and other family members, social standing, finances etc.
ISTM that over the long term, keeping an extramarital affair secret is extremely tough. There’s ample opportunities for the current spouse to find out about it, whether it’s unexplained absences and other changes in behavior, evidence in the form of text messages and emails etc., or other people observing things and passing on the info.
But beyond all that, ISTM that most extramarital relationships break up eventually. A pretty high percentage of marital relationships break up eventually, and the percentage of extramarital relationships that break up has to be a lot higher, what with the clandestine nature, the stress involved, and the relative weakness of the connection. And the thing is when relationships of any sort break up there are frequently hard feelings involved. And at that point, one or another party just might be inclined to spill the goods on the other (or possibly to blackmail them), or at a minimum to be careless about it.
In sum, ISTM that the chances of being exposed eventually are pretty high, and unless a person is in a position where such exposure will not negatively affect them, there’s a pretty good chance going in that it will not end well.
Of course, there’s always the fact that the ones which do end well are the ones you’re least likely to hear about. Nonetheless, my guess is that the ones which don’t work out OK are the vast majority.