Ronald Fairbairn explained this really well; he described the “exiting yet frustrating” object. This is well explained in a paper titled “The Allure of the Bad Object”, that can be found online. Its the best single paper on this subject.

“There had been indications that the other was incapable of reciprocating, or loving, or accepting them in the way they desire. They had been pursuing an alluring but rejecting object; an exciting yet frustrating object. The object initially may have offered the conditions of hope but it failed to satisfy. It had awakened an intensity of yearning but it is essentially the elusive object of desire, seemingly there but just out of reach.”