you can't just pin it down to a single cause.. there are quite a few:
1, old-fashioned superiority. This was the principle cause in the past.. the idea that we are more developed and advanced as a society, and we are white.. they are less developed, and they are black. So we are worth more then them/better then them etc.
Mostly this has died away, but it does certainly still exist on the extreme right.
2, fear. Generally this comes from two parts - 1 a fear of violence/harm, and 2 a fear of loosing something (normally ones culture). This type is different from the first, because it only exists when the two races meet. For example a person from type 1, would see a documentary about black people in africa and think awful things about them... a person from type 2 would think nothing bad at all. But then were a group of black people to come suddenly to where person 1 lived, they would start to think negativly about them.
Its worth noting that sometimes fear can be rational and logical... but mostly these days its not.
3, Nutural group biases, and similarity bias/majority bias. This is where we are at today.. these are the causes of micro agressions and most of the small racist tendancies and problems in the UK.
We have largely got rid of causes 1+2, but 3 is much harder to get rid of, and arguably it may not be possible to get rid of. These cause people who don't have a conciously bad thought about another race, to act in a way that ends up minorly disadvantaging the other race. For example, white people wanting to live in mostly white neighborhoods.. is generally just because they feel comfortable with those they are more similar to... the majority of our public figures and business leaders being white (often disproportionatly so) can usually be put down to a majority bias, where groups within organisiations favour those who seem more similar to themselves, and the largest group ends up being the most dominant.. etc.
With the exception of the majority bias, you also see all of these causes within minority communities themselves, as they are very nautural functions of how we interact with other people.
4, Practical reasons: this one is easy.. some people become racist because a person from another race has harmed them (or they think so) and they blame the whole race for it.. for example the working class man who looses his job when lots of polish people come to town.. or the white mum whose daughter is raped by an asian gang.. its an illogical position to blame a group for the actions of a single person, but in those situations people are usually reacting on emotion rather then logic.
5, Ignorance. This is not a huge one in the UK, but it is in other places. I live in China, and I would say that here its the number one cause. All of the people I know here have simply never met a black man. there are none in this town, and they make up 0.00001% of the nearest city. The only exposure to black people they have ever had is through american movies.. and most of their ideas and problems with black people comes from simple ignorance and a lack of experiance.
6, political goals and practical aims. Some people become 'racist' because it can advance their career to view ideas in such away, and given time they simply adopt those ideas fully, and its hard to tell where the distinctions are any more
7, Patronizing superiority. This is one you see on the fringes of the left. Its where you have a left-ist who needs to save black people, because only they can. Its a person who is trying, genuinly, to do something nice.. bu they still have a superiority complex, and still view minorities as less, as fragile and vunerable, and child-like.. individuals.
---
I'm pretty sure there are more. With such a complicated issue, there are bound to be many many causes.
Its also always good to remember that there are many many types of racism as well. Its not just - YOUR A RACIST.. end. Its - what type of racist are they. You need to understand that before you can try and propperly challenge them on their ideas (or not, some of the types of racist will never be pursuaded)