Is it a pattern?

Some friends and I always wondered why I meet the wrong people.
Why am I always attracted to the troubled kid? And always reach out to help him/her, and get bitten in the ass each time I do it?
Why do I always try to keep my connection with that kid, even when I see rejection flying and feel it like a blunt hit to the head?
I think... It's because some times, I think I can relate to what they feel you know?
Like what they think about the world, and how is it a shitty shitty fucked up place!
but its not healthy for me, I always meet up with those people who feed me violence and sardonic thoughts, who always hook me up with misery, people who simultaneously ruining my life while making me laugh to the point I feel like I am going to burst!

you know, I know when the person I am seeing is a bad deal, because the moment I see them no matter how good she looks or how sweet he looks, I just feel that its a bad deal, when I feel like they are a perfect desolation of human evolution, I mean just perfect, but very very sad and self-depressing, they just don't know how good they have it, and just because they lack some materialistic object, they wallow, and keep wallowing!
I attract them somehow, and vice versa, I wish if there was one of those metal detectors, only for people like this, I could just wear that gadget, or register for it online, I am willing to pay seriously, and just get them out of my life!
Again, why do I attract them?
Why do I get attracted to them?
Is it because I love depression and it effects on people?
Is it because I am addicted to misery?
Is it because pain always seduces me into its net?
Is it because I like to take care of people?

Many questions pop into my mind, but I can't seem to find an answer for any of them, I am positive that there is a perfect explanation for this, but I can't seem to get a hold of it!

If only I could detoxify myself from those sad people, somehow I am convinced I would be perfectly happy!
But again, the grass is always greener on the other side, so I am back at square one!
Is it a pattern?
Am I only attracted to sad, miserable, troubled and depressed people?