You need to do a lot of different things to gain respect. Respect comes in many different forms. It can be physical or mental. I nod of the head or just a thought. All signs of respect. Before you get respect though, you have to respect yourself.
Self respect is how you hold yourself, confidence, and pride. Don't show shy body language. If you hunch you shoulders and keep your head down, you look weak, and not worthy of respect. Dress on how serious you want to be taken. A suit looks a lot more serious than a t- shirt and shorts. Looking professional is usually the first step to getting respect.
If you work hard at what you do, you can gain respect. You can gain respect by doing your job well. If you want respect in a certain area, you must try your hardest in that particular area. People will see you hard work and determination and give you respect for doing it. Being lazy shows people you don't care, and that you shouldn't get any respect.
Helping out can also give you respect. If you show that you are helpful, and can be trusted, people respect you. They will come to you more often for things they can need done. In return for doing it, you get more respect from them, and they put you in higher standing.
All of these things can give you respect. None of them are guaranteed to give you respect, but all of them make you more likely to receive respect. In short; Dress nice, have confidence in yourself, work hard, and help others and your chances for receiving more respect will be very high.