Lol, good question.
I'm speechless 'cause I wonder the same thing once in a while, but I'm gonna try my best to answer, it may not make sense haha.
But I think, that since we want to be with them sooo much, we tend to overlook things they do that hurt us, and we become dependent on them for our own happiness. Thus, we feel that we need them to be happy. So we want to be with them even more, and the cycle continues.
Now what makes us want to be with them soo much in the first place is another question.......For me, it's usually because even with all the hurt, when I look at them they still shine like gold! I see their potential to be the best they can be, so I believe in them and put my faith in them.
Maybe someone else can help answer this question?