1 They feel inferior
Some studies have shown that people put others down when they personally feel inferior. By claiming that they belong to a higher or a better race, those people can feel better about themselves. (See What Causes an Inferiority Complex?)
2 To gain self-esteem
Some people become racists in order to increase their self-esteem. This of course happens on an unconscious level. In other words, the person never knows why he became a racist but he just feels good about it.
3 Lack of courage
According to individual psychology, brave people strive for superiority by doing useful things and making useful achievements. Those who lack courage, on the other hand, strive for superiority by doing useless things such as being racists.
4 To belong to an elite community
Humans love to belong to tribes and what's even better is belonging to a great tribe. Some people abuse that basic human need by trying to claim that their tribe or race is better than other races.
5 To protect themselves
People can become racists because they are afraid to interact with a certain group of people. In order to protect themselves, their mind forces them to become racists to keep them away from people they are afraid of.
6 To hide their doubts
Some people who have some doubts about their own religious beliefs become racists towards people of other religions. The main cause behind that behaviour is the fear of knowing more about those other religions.
7 Jealousy can cause racism
If a person became jealous of another, he might search for any method to put that person down. Racism in such a case can be the preferred strategy for a psychologically unstable person to put someone he is jealous of down. (See Why do people become jealous of others?)
8 To get a cheap victory
If a person hates another, he might try to find any fast way to put that person down. Racism can provide a fast and cheap victory for some people to put down the ones they hate.