I think that people have affairs for lots of different reasons. However I think that it is an over simplification to say that it is always because the guilty party does not care about their partner and/or wants excitement.
There are a lot of people who feel trapped in a marriage which does not give them what they need. When a spouse does not meet someone's emotional needs, but does not do anything terrible, and where finances, personal circumstances etc make leaving difficult, then I can understand why someone may have an affair. I have a friend who is in this position. Her husband does not see emotional support, companionship etc as important. He has his job, computer, hobbies etc. He will not agree to discuss anything, will not agree to a divorce as he says that he is perfectly happy and that any problems are "her fault". Divorce isn't that easy, especially as he is the main breadwinner, she has small children, etc.
I'm not saying that she is "right", just that she was desperately lonely.
My brother also had an affair. His wife was obsessed by the kids (7 and 9 at the time) and had no time or energy left for him. He helped a lot with the children but any attempt to get her to spend time with him alone, without the kids, failed. We'd offer to baby sit so they could have an evening out, weekend away etc but she just said that she didn't want to, that they (she and my db) were "past all of that" etc. She wouldn't even spend evenings in with him, "as a couple" (ie just chatting, or watching TV together) it was like a switch had gone off when she had the kids. She had her children, and her girl friends, so didn't want to talk to him. He tried talking to her about it (so did I actually) but she just said that she was happy, that marriage is "about the children" etc etc. Again he was desperately lonely but didn't want to lose contact with his kids and ended up having an affair with someone from work. He has now ended that and is trying to get her to go to Relate but she still insists that there isn't a problem and that he needs to find friends outside the marriage etc etc. (Not that easy for a man as most men do not want to provide emotional support for their male friends).
So in some cases I do think that people have affairs because they are very lonely within their outwardly happy marriages, and that they do not leave because their partners appear very happy/it is hard to leave/they have kids, and they cannot fix their marriages because their partners are uninterested in fixing it as their partners are getting what they want.
I know that the obviously response here is that the partners are not getting what they want as what they want is a faithful partner and this is very true. But in some cases it is the partner who is also trying to "have their cake and eat it" in some ways as the partner wants the practical side of marriage but is not prepared to provide companionable or emotional support.