How did consciousness evolve? What has been said above, awareness of being an individual is necessary. A rabbit needs to know the fox at the hill is not himself, otherwise it wouldn't run away. And having a conscious ego is more difficult to explain. Self-awareness tends to make organisms more greedy and protective of their 'belongings'. And maybe it makes us extremely egoistic. Since consciousness is possessed by the individual. Since it is only yours I believe it creates a belief of superiority. And an urge to better ourselves. Also the sexual selection is an excellent point. Having a consciousness means you are aware of how to attract more females/males and you want them more for yourself than animals are possessive. We also believe the world is ours. Since we think so we are more prepared to protect it from threats.
Still it is a very tricky instrument, the ego. Scientists still do not fully understand what purpose it serves.