Why do I attract people who hurt me?


It is not people who hurt you. It is your own foolishness, your own mind, your own vulnerability and your own emotions that entangle you, and make you feel hurt.
Do you think people have no other business, that they want to come and hurt you? Do they get a lottery by hurting you?
What can hurt you? Somebody’s words, somebody’s selfishness, somebody not caring for you. You love somebody and you think they don’t care for you, or you have helped somebody a lot and they do not talk to you, and that hurts.
My dear, wake up and see, is there an intention in them to hurt you? You need to see things from the other side as well. Place yourself in their position
Many times it happens that you never intended to hurt someone, yet they felt hurt by your action. What do you tell these people who feel that you have hurt them? 
You say, ‘I did not mean it, something happened through me. I did not mean to hurt you, but an incident or event happened that gave you an idea that I hurt you’.
Now if you really intended to hurt somebody, then it means you have a deep hurt inside you. Even then, you are worthy of being excused. And, you have to excuse the other person as well.
If someone has hurt you intentionally, you should know that they are sick. What should be your attitude towards someone who is sick? You should be compassionate towards them. 
If someone has not intended to hurt you, it is an unintentional act, then it is your own mistake. You can only blame your own perception, and not them. They are not culprits, it is you who has to ask them for forgiveness, ‘Please forgive me because I mistook you. I thought you intentionally hurt me.’ Then friendship grows.
If someone has scolded you or used harsh words that have hurt you, and they have done it with a very good intention, then you can only thank them. This is because you have only grown stronger by their act.
No parent has raised their children without giving them a piece of their mind, isn’t it? Yet, do you feel, 'Oh, they have hurt me?' They may have used hurtful words, but it has been for our own good.
If a friend has insulted you, knowingly, you can only thank them. This is because they have had the courage to give you their piece of mind, what you needed, otherwise why would they do it? Why would anyone want to hurt you at their own cost? Nobody wants to risk their friendship. 
What should your attitude be? ‘Thank you! You did something good to me, it has made me strong.’ 
It is all in your hands, how you view things; what type of intention you put out there, that will come back to you. If you think that everyone is hurting me, then your own intentions will create similar situations again and again. 
When you wake up and see, 'There is none other than the One, and the One comes to me in many forms. It is all for my growth, for my well-being, for my happiness'. This is because the Universe is so loving, and compassionate towards you. If we can keep this wisdom in our heart, nobody can hurt us. 
In India, there is a proverb, ‘If God is happy with you, He gives you a lot, and if He is very happy with you, then He gives you a slap also.’ This is because every time God gives you a slap, He turns you away from the material world towards Himself; He wants to draw you to Himself. Drop everything and look at Him. That is why He gives you the slap because He is too compassionate and too happy with you. 
Everything is an opportunity in life. If you are happy and comfortable, it is an opportunity for you to recognize the truth and share it. If misery comes your way, make use of that as an opportunity to turn inwards, and become very strong from within, and recognize the truth, the reality of the Universe, i.e., everything is changing, every relation is fleeting. 
All this leads to that one reality, that everything is nothing
Buddha said, ‘Everything is nothing’, and Adi Shankaracharya said, ‘Everything is one thing’. In one thing, there is love, joy, and in nothing, there is peace. 

So the first step is, everything is nothing, then there is peace, and to top it, everything is one thing, that brings love, joy and celebration; that is Vedanta.