I often get phone calls that start something like this: a person with a well-mannered voice says, "I need someone to talk to. I'm having relationship problems." When I ask for more detail, they name some general problems. "We have a hard time communicating." Or, "we don't spend a lot of time together." They may avoid adding any more, simply asking to talk more about it when we meet. If they're feeling especially brave or desperate, they may confide "I can't believe I'm in this situation but I want to save my marriage. I did something I never thought I'd do. I had an affair and my partner found out. They've told our friends and family and I'm so embarrassed. I don't know how we'll ever get over this."
I think to myself, I feel for them. This is a person who now has an opportunity to get to know more about parts of themselves and their life they'd rather disown. They're starting to realize how much hurt they've created and how hard it will be to mend. They're probably equally longing to make things better and wishing they could run and never face what's happened. If they're open to the process, they'll begin to understand what led to the affair: whether it was happenstance, a symptom of an unhappy relationship, or their own personal issues. They'll learn what they can do to repair things - if they want to and their partner is open to that. They're about to get to know more about their feelings (the obvious ones and the more subtle, confusing ones), their needs, and how they go about sharing and taking care of those with themselves and their partner.
People rarely commit to intimate relationships with the intention of losing their partner's trust. No one gets married to get divorced; no one moves in together envisioning ongoing unhappiness or heartbreak. But when they create betrayal they get a chance to grow into a stronger, more compassionate and honest version of themselves. Whether they get a chance to share that in their current relationship or bring it to a new one remains to be seen.