I've been theorizing this for quite some time. I also previously posted this piece as a shorter reference.
The basal explanation I use is you have the people you connect with from your heart and the ones that get in your head. Naturally, there is extensive crossover as we all face growing pains and crash into one another like bumper cars.
All experiences lead to lessons, and they are repeated with different players until you get it. So you could say that it is your ego that creates these patterns then this becomes apart of your attraction model. This applies to all types of relationships from personal to professional. Also, your mentality toward an entity like money, for example.
I think to get real esoteric for a moment, our souls can recognize each other. Somehow someway, someone is meant to light a spark in you or burn it out as guidance.
Based on experiences we have been through, however, the latter may transpire because we are simply looking to fill a void within ourselves and that is an egoic connection. It does not mean that love is not present, but it may not have the purest intent nor longevity. In these cases, we are meant to learn to love ourselves more as a result and trust our instincts.
That initial spark of light that transpires when you meet someone and have that knowledge about them can dissipate by your doing and theirs. Generally, this form of "SABOTAGE!" (I always imagine the Beastie Boys yelling it to make the world a little more fun) comes from your past hurts ingrained in your conditioning and vice versa. It's like you are secretly battling each other in an underground fight club, which of course we aren't supposed to talk about.
If you take a look at your part in the mess created, you can see your egoic nature through a blunt honesty with self. If you can also pinpoint the reasoning of someone being in your life and essentially they are there to cover up a suppressed or unrealized part of you then your ego has created that feeling of inadequacy and developed co-dependency.
I have looked back on my history and realized that shared or similar traumas that bond you create this falsehood as well. The lack of truth is how we can connect sometimes because the alternative is frightening. From here the patterns perpetuate and those egoic connections can dominate your heart ones. But I suppose the heart connections are the ones that linger, that never truly go away. You could speak to an old friend after years gone by and their energy still resonates.
Your ego seeks to sabotage if it feels threatened. People are afraid of themselves then end up being afraid of one another. If you do not let your heart lead because you have been hurt before, you build these ego connections instead. You develop an odd sense of comradery, and in your mind as f*cked as it may be, you feel safer in this place where you can remain fragmented because others will fill in the blanks for you. Don't get me wrong, a team effort is great and necessary, but you have to truly trust your teammates.
If seeing them, thinking of them, no matter how long it has been, no matter what crap happened in between (again, lessons) those are the heart connections. You see their worth, their magic, their je ne sais quoi, whatever it is. They are the ones that reflect the best parts of you and the ego connections guide you toward balancing out.