I know that feeling well. I think the first thing you have to realize is that you did not fail. There is improvement to be made, yes, because let's face it, we are not perfect and we can all improve.
However, it was his choice to have an affair. Mine had one too. I realized that although he did try to talk to me, he was afraid, and so he was not as forthcoming as he could have been. However, talking to someone else was a lot easier. Especially early on.
Let me tell you, the affair did not last long after we split. However, he has gone on to date other women rather than maybe try to fix the problems.
Now, I can tell you all this, but in reality, there are a few things that really helped me.
first, memorize the Serenity Prayer, and figure out what it means. You only have control over you, so the biggest thing you need to do is detach.
On that line, how to detach? My therapist told me (and this does work), every time you feel like you are getting to involved w/ your H's problems, look at it as if it was someone else's relationship...a fried...family member...and then think about what you are about to do and if you would advise the other person to do it. Usually it works because you are looking at the problem from the inside out and that way you realize its not your problem to solve.
Baby yourself. Cry, get mad (make sure you get mad because women generally don't) and realize that this is NOT all your fault. Women generally take the blame for the marital issues...why did they need someone else, weren't we good enough (I have asked every question). The affair is what it is. In marriage, sometimes we get comfortable and complacent, and forget to tell the other person how much we love and need them until it is too late. And then we want to reassure them all the time, and it pis$es them off because they don't want to hear it.
The biggest thing is you have to go into this accepting that this relationship is over. It is really hard to do. You need to grieve.
That is not to say that in the future, you can create a new relationship w/ your H. But it has to be different. Learn from what he is telling you, but don't ask. Trust me, they do offer. Mine still does...still says I didn't listen to him. And now I am in a place where I can counter and say true, but you also did not communicate well with me so we are both at fault.
Time does heal. If you were to ask me if I hurt anymore, the answer is no. But I do still miss my H at times, and even though the divorce is filed, I wonder what the future holds. I am glad I still love him, but am also glad that I am not quite so wrapped up in his day to day bullshiznit...
Im still standin better than I ever did looking like a true survivor feeling like a little kid Im still standin after all this time and Im picking up the pieces of my life without you on my mind..