Personally I wouldn't want to have an affair. I'm too lazy when it comes to trying to keep up the various lies needed to keep it a secret. Secondly in the long run it's better to go through the divorce if you're extremely unhappy than to continue to stay and use the affair as a Band-Aid. People have affairs to tolerate their marriage.
Having said that I do understand why many people have them. The goal of most cheaters is to hold onto all that is "good" in their primary relationship while addressing their other "needs" on the side. The majority of cheaters aren't looking to (replace) one relationship with another!
Sometimes people don't "proactively" look to cheat on their mates, It may be a situation where a stranger simply treats them special and makes them feel better about themselves. A "secret platonic friendship" develops which eventually leads to sharing one's unhappiness and feeling understood. Much like the emotion of love is often projected on a therapist, teacher, mentor...etc
Not long ago I asked a question on HP: "Is an unhappily married man more likely to cheat or file for divorce?"
Over 90% of the responses said he'd cheat!
Basically the argument is the man would look at the financial cost of going through a divorce, moving out of his home into an apartment/condo, paying child support and possibly alimony, becoming a weekend dad, and breaking the news to family, friends, co-workers, and acquaintances Versus having an affair. From that point of view cheating (seems) a like a better option. Mind you the average cheater does not expect to be caught!
Another question I once asked was: "Is sexual incompatibility enough of a reason to end a marriage?"
(Lack of sex, passion, or romance is often sited as a reason why people cheat)
Once again over 90% of the answers came back as "no". I suspect even cheaters are in agreement with that! In fact mistresses are often warned by their friends: "The husband (never leaves) the wife."
Something tells me if I had asked:
"Would you rather your mate cheat on you or leave you?" Most people would say they'd rather their mate leave them! Essentially it's the same question asked from a different point of view!