I think the answer is simply practice. On one hand, I've always been a fairly confident person, but I also had to learn how to teach others to treat me. If I didn't demand respect, I didn't always get it.
For me, practice and internal talk is how I learned to demand better treatment. If someone tried to intimidate me, I learned not to back down - not necessarily aggressively, I just refused to turn tail and run. It's almost like a dog pack mentality, if eye contact makes you feel uncomfortable, you're choosing to be a subordinate member of the pack. If you hold your head high and look people in the eye, you're body language says that you know you are the person's equal, not inferior - and usually what you say about yourself (through your body language, expressions, and eye contact), others believe. You tell them who you are, before they even meet you.
It's not entirely that simple, but largely, I think it is. I've definitely noticed a change in the way people treated me when I changed how I treated and saw myself.