The first thing that you ought to do is to deprive your teacher of the reasons to dislike you. If you have gotten in his/her bad books because of the pranks that you pull on your class-mates, make it a point to never play a prank in his/her class again.
If the teacher has a problem with your clothes, make sure you are tidily dressed up. If you have been regularly failing to complete your home-work, then make it your first priority. Make sure you always bring your own books and stationary to class, so that your teacher does not think of you as an irresponsible child.
Once you have minimised, if not eliminated, the excuses for your teacher to dislike you, proceed to start earning his/her respect. Try to be the student who asks questions during class and is always the first one to raise his/her hand when the teacher throws a question at the class. Make sure you study hard for your tests and score good grades, thus proving to your teacher that you have been paying attention in his/her class.
When your teacher scolds or humiliates you in front of the class, do not start crying. It will only make you come off as a cry-baby. Do not smile either.
Wear a sober expression on your face until the teacher is done scolding and then apologise to him/her.
Do not commit the mistake of talking back and don't argue even if you are being unfairly scolded. If you have something to say in your defence, do so when it is your turn to speak. Otherwise, go over to the teacher after class and explain yourself politely.
Be regular in class. Do not let the possibility of getting scolded or humiliated by him/her scare you away. Skipping classes would only make your teacher turn against you even more.
Do not be afraid or shy of defending yourself in case your teacher takes you to the principal’s office. Speak the facts, while being careful not to say anything disrespectful or offensive.
Do not go around saying bad stuff about your teacher. Somebody in your class may convey your feelings to him/her to score points, thus getting you into trouble.