This is only written from my experience and I have not really read any books about it so take this for what it's worth.
I'm going to look at this from two angles.
First, a relationship with the opposite can approach that dangerous edge when you engage in very personal conversations with someone. They especially get dicey when the conversations are about a girlfriend/boyfriend or spouse. Many times part of the attraction starts to be that this person "gets" you while your spouse does not. It is also dangerous because a man begins to critique the H or the woman critiques the W. So then the man or woman begins to think there spouse really is the one at fault and is the one with the problem. After all here is a man or woman that is validating the spouse that they are being wronged.
For my personal story my xH always developed close friendships with women. To begin with when we dated there were girls that were past friends that he would not include me in get togethers with them. This was uncomfortable but I really thought this feeling was my issue because of being cheated on by a past long term boyfriend. So I would tell xH I was uncomfortable "I feel left out when you do not introduce me to these women friends of yours and I worry" and "Lisa does not even know my name which feels weird since we have been dating for over a year" and rather than consider my feelings he would say "since you feel that way you need to figure out how to not feel that way". But these friends graduated, moved on, married, etc. so they became less of an issue. In Law school one of two people he studied with was a woman. The first time I met her he made some comment about how I was now going to be more jealous because I saw how pretty she was?? Anyway, I handled her okay because she was always respectful of me and it was obvious that their friendship was based on school. Then we married and there were women he worked with that he had what I considered boundary crossing conversations. These were all behaviors that set up the actual first full blown EA, in my definition. This woman was again at work and she became someone with whom he would confide things and then I would end up not hearing the story. The first time I met her was at a party she was having. Within 10 minutes she grabbed xH's hand and asked if they could go talk. He walked off with her and they sat on a couch together. I tried to be the cool wife and talked with others at the party. Finally I went over at an hour or so when others had gathered. She grabbed a bottle of beer from my xH's hand and took a drink then rested her head on his shoulder. I endured all of this and even waited a polite 15 minutes in the car as we road home just waiting for him to EXPLAIN. When I finally asked what all of it was about, he was miffed at me for being bothered. "She's just a free spirit, that's the way she is, she was a little drunk, and her boyfriend was there so it was no big deal. And what's your problem??!!" So in my mind the other issue is that in the EA the EA partner is the one who is protected and the spouse is the one who is derided and complained about. He began to share special things with her, met her family and friends, spent time alone with her, etc. This is an interesting story because there was NO PA ever. The reason this is important is because he felt like that made it okay. First off it did not make it okay because the energy he gave to her and shared with her should have been directed to ME. Second the hurt feelings I NATURALLY felt also intruded on the marriage. And finally although this did not become a PA, the next EA he indulged in DID. This is also how I came to find out more about that first full blown EA. When xH confessed to the affair, he did so before he ended the affair so after I agreed to work on the marriage he went off to break the affair off on CHRISTMAS EVE. So I'm sitting at home alone devastated knowing I cannot possibly call anyone on Christmas eve for support. Then I remember that xH said that first EA friend knows about the affair (her advice was to end it right away and not tell me). She happened to be Jewish so I felt okay about calling because I just needed SOMEONE. It was funny because she answered the phone hesitantly. She later said she thought it was xH calling and was po'd enough at him for the whole sitch she wasn't even sure she could handle talking to him. SO she was very kind to talk with me for a half hour. Not really sure what we spoke about but she was comforting. What I do remember is finally realizing that this woman was just absolutely clueless about what her behavior had done to my marriage. We did not go into that topic at all but it was just the way she spoke about H that made me realize it. She viewed him as the big brother and guy friend she had never had. So the girl was just clueless of "proper" etiquette with guy friends' wives or girlfriends. I have had numerous guy friends so I have learned very quickly how to make the women at ease. I make it clear that I know who is the woman in their husband's lives and that I respect that. So far I have NEVER had a problem with a wife with that attitude. But it is a conscious and respectful attitude I have.
And this is the second angle, intuitively I have been aware of the EA issue since probably high school and at least college. By the time I was in my early twenties as an engineering student who had to interact with a lot of men, I developed a kind of strategy to keep myself away from that dangerous line.
I had plenty of male friends but I had some "rules" 1) no personal confiding with male friends (MF),2) no talking to MF about anything that I would not tell xH 3) No talking about xH in any other light than positive 4) Do not EVER speak about MF's girlfriend or wife in anything other than positive light. Even if they are crazy or witchy figure out some positive spin OR keep mouth shut.
That's it. Nothing too complicated but if I kept myself a good distance from that fine line I never had to worry about losing my balance, tripping, etc. or the MF losing his balance. There was plenty of SAFE space between us. Sure I acknowledged to xH I could be losing out on a GREAT deep friendship with a MF but the upside was that my marriage was safe. I valued my marriage over these friendships and my xH did not. A personal choice that he was free to make and it hurt me but I lived. I then had to trust and accept that he would be vigilant in these relationships to prevent PA. Too naive and trusting, maybe but I loved him and wanted to stay married.
But what is happiness except the simple harmony between a man and the life he leads? ~Albert Camus