For an affair to occur, there typically is some sort of marital deterioration that has happened over the course of many months or years that both spouses have contributed to.
I recently was introduced to a book by Dave Carder called: “Torn Asunder: Recovering From an Extramarital Affair” and it brought to light some interesting points on recovering from infidelity