Because they can give you something that you want but you can't get from any other people.
Or
Frustration attraction
Or
We all have a tendency to want what we can't have. When someone we care about doesn't care about us, it makes many of us want that person even more.
yosamm