Good question! I looked into the evolution of consciousness because I wondered if it might be a self-defense mechanism and I learned the following things:
1) People define consciousness differently. I think this is because it is itself made up of more than one thing. For example, differentiating yourself from the external word is one element of it, the ability to inform decisions with recent information another, the ability to predict, the awareness of emotion. These various elements have developed over time.
2) No-one agrees, thanks to the above, what has consciousness and what doesn't. An oyster certainly does not, a human certainly does not, a bottle-nosed dolphin probably does and a cow probably doesn't.
3) The biological potential for consciousness did not necessary mean that the organism had consciousness. Kinda like, just cos I have a car don't mean I know how to drive.
4) The general consensus as to why we developed what you and I probably think of as consciousness lies in the origins of our species. When our ancestors left the forests and moved across the plains of Africa, they needed protection from the sun. Obviously balding helped, but so did standing upright. Hence they were called homo erectus (or maybe that's because they were naked and...). Now a creature on all fours has an upper limit to the weight of their head as it has to be supported by their neck. Homo erectus increased this upper limit. Gravity did it's work - the soft skull gradually squashed and the brain filled out to use it, developing the eleongated prefrontal something lobe (it's been a while). This lobe essentially consists of processors. As the creature takes in information via it's senses, older information gets pushed back and back to 'later' processors until eventually the information gets so old it is dumped to long term memory. This gives the animal a concept of time. These processors not only allow instant access to most recent information, but also allow cross-checking - i.e. more information can be used to make a decision, and the notion of cause and effect. For instance, when you see a car accident, you KNOW the screech of the brakes came before the crash of the cars colliding, because the screeching is in an 'older' processor. However, when you think about when you fell off your bike when you were a kid and when you had your first pint of lager, you rationalise which came first - you were older when the latter happened. When it comes to older memories close together, we have trouble recreating our history.
A cow doesn't have this - if you jump out at a cow, it will access the same information every time. A cow with elongated prefrontal lobe will do so the first couple of times, but the next time may recognise you and jump back at you to freak you out. This leads to what is thought to be a major element of consciousness... the ability to predict. It also leads to a differentiation between emotion and feeling. Cows have emotions... they can be easily scared (I should know... it's a hobby of mine). But cows aren't aware that they're scared... they don't FEEL scared. This information just isn't available to them, or at least not for very long. With an elongated wotsit, the awareness of emotions can be linked to their causes and we can rationalise our emotional responses. As for what triggered the USE of these facilities... I don't know. I'd still lay money on a survival tactic, in which case everything you are, your likes and dislikes, etc is a side-effect of a now-redundant survival trait. But that's a guess. Anyway, depending on the criteria you define for which a creature has consciousness, humans are the only animals known for sure to have it.
This doesn't mean others don't. Gorillas and dolphins have passed the mirror test, where the animal has an ink-stain on it's side and they are shown a mirror. If they attempt to get at the stain, they are showing self-awareness by being able to differentiate themselves from the outside world and recognising themselves. However there is some contention over how informative and trustworthy these tests are. The interesting thing about dolphins, of course, is that their brains evolved on an entirely different path. They have no frontal lobe or prefrontal lobe (can't remember) at all. Gorillas, if I recall, have a frontal lobe but no elongated prefrontal lobe.
That's a brain dump of pretty much everything I know about it. Bet you wished you hadn't asked, huh? This doesn't quite answer your question, I know, but it boils your question down to 'how does the brain store information', because consciousness is just a result of information being stored in a different way.