To a great extent, this is the type of question that goes to the very heart of determining one's presence in the classroom. This is the question that does much in way of self- definition and self- reflection. For many teachers, the essence of their being in the instruction setting comes from whether they want to be perceived as lenient by their students or as a strict force. A teacher decides to be strict or decides to be lenient, in large part, of how they wish to be perceived by the students. A show of force in terms of being strict or harsh might be needed to ensure compliance. Another reason why teachers might be strict or focused in the classroom setting is because of the large amount of curriculum that needs to be covered. For some teachers, so much content is externally dictated that the need to be strict is seen as the only way to guarantee or at least try to attempt to cover such a wide array of content.
There is a more subjective reason behind why some teachers are stricter to individual students is a matter of choice. Sometimes, teachers think that they need to exert a bit more force and intensity upon a particular student to unlock that student's potential. Teachers would call this "tough love." Sometimes, a teacher simply does not like a student. It is not a comfortable reality to embrace, but it is a reality. There are times when a teacher or professor simply does not like a student and being harsher or stricter to them is something that comes naturally. The hope here is that some level of internal reflection is needed that prevents this from being a perpetual state of being for both teacher and student, but this is a reality behind why some teachers or professors are harsher to some students over another.
No matter how much we like to think of ourselves as being impartial, it is a fact that we will encounter some students with whom we either do not get along or whom we will dislike. For some of us, that will mean that we will treat those students differently, maybe more harshly, maybe by not giving those students the benefit of the doubt.
However, that is different from being a strict or lenient teacher across the board, and I suspect that most of us strive to put our own personal likes or dislikes aside when evaluating students' work. I find it works much better for me to emphasize from the start that I will grade a student's work rigorously and that I do not have to agree with a student in order for that student to earn a good grade. In additon, I make it clear that I will not tolerate certain kinds of behavior and that respect in the classroom ought to be mutual along with being earned. That works both ways, too. It's true that sometimes students just don't like the teacher as much as the teacher dislikes the student.
Most problems can be fixed by communication; if not, and the teacher/student relationship is really and truly broken, I've actually recommended that a student switch to another section of the class. If that isn't possible, you just have to agree to disagree and try to be fair for the remainder of the term.
There really is no way to avoid it. Teachers are human and are capable of treating people differently. While I truly believe it is a teachers true intentions of being fair, firm and consistent; we all have personalities that relate with some and are rejected by others. While their treatment of others may differ, the education they provide their students should be universal and unbiased. They may not be as chummy with you, but as long as you're receiving the same education, that's all that matters. In my experience, if you feel as though you're not meshing with a teacher, catch them one-on-one and express your concerns in an educated manner. Again, we're people too and would hate to see a student feel rejected. However, we can't fix it if we don't know it's broken. Communicate.