Be nice to those who deserve it. Don't be nice to those who don't. Give people what they deserve from you.
So, in order to get people to be nice to you, you have to do 5 things:
1) show them that if they're nice to you, you'll be nice to them in return.
2) show them that if they're not nice, you won't be either
3) show them that they have something to gain by your being nice, create a positive, desirable, image of yourself.
4) show them that they are missing out if you're not nice to them.
5) show them that it's all the same to you, and that you don't give a fuck about them, but if they want something, they have to earn it.
So to sum it up, you have to show people that you're someone who doesn't take shit from anyone, but who is truly good to have around once someone gets on his good side. Make people work for your friendship, they'll attach more value to it, and respect it more. Basically you have to create the idea that it is a hard to earn privilege to be you friend, or to be someone who is liked by you.
The catch is that, in order for this whole thing to work is that you actually have to be intelligent, good looking, knowledgeable, eloquent and witty. Work on those characteristics, then apply the above method. If you aren't and can't become any of the above, you're pretty much doomed.
Never let people know that you need them. Don't need them. They must need, or want, to be with you.
Just my opinion on how to succeed in society.