There is no one answer to this question as racism has arisen in response to a number of different factors throughout history. Some of the reasons that have been suggested include the need to justify colonisation and slavery, to create a sense of national identity, and to deflect attention away from social and economic problems.