i have to sympathize, cause i too experience the same damn thing.... it's so annoying.
It's like attachment, jealousy, anger, yearning....mixed into one.....all negative.
I usually become friends with girls i dont see any future with.
I have a theory.... i guess it's because men , by nature, are competitive, and when you see your not winning her, it's a total let down that makes you want her even more, creating 'attachment'.
I dont experience feelings of 'attachment' if the 'breakup' is on my terms. For example, i hooked up with this girl, and she n me were getting on preety well...nothign very serious, but definately mutual attraction. Then all-of-a-sudden, i find out she slept with another friend of mine... that made me feel attachment, jealousy, anger, yearning, etc, and i wanted to keep trying to get back with her, id hang out with her, try and flirt,etc.... but i guess the feelings showed, and it didnt work.....and im kina glad, cause shes quite the village bicycle.
Many ppl will tell you, 'time' will help you get over it. I think the way i get over it, is when i find aother girl to hook up with ....and the cycle continuew

.
Cheers