Just a fluke.
Why would there any more purpose to evolving consciousness than there is to evolving livers or sweat glands?
The liver is certainly a miraculous organ, the purpose of which is quite clear and requires little in the way of metaphysical rumination to explain it. Indeed I was about to say that this most robust of body parts has inspired little in the way of artistic or philosophical achievement, but then I remembered 'Liver' by Will Self, a mesmerising fictional treatise in four parts, which I thoroughly recommend.
Where to start with consciousness though? The Upanishads perhaps? Blake, Keats, Shelley? Dostoevsky, James Joyce, Sigmund Freud, Carl Jung? Many great minds have had their imaginations fired up, simply bycontemplating the miracle of their own awareness.
So rather than try to answer your question myself, I'm inclined to direct you to any of the great minds listed above. But I will leave you with this quote from the Indian academic Eknath Easwaren - this is from his introduction to his English translation of the Upanishads;
"There is a Reality underlying life, next to which the things we see and touch in everyday life are but shadows. This Reality is the essence of every created thing, and the same Reality is our real Self, so that each of us are one with the power that created and sustains the Universe. This oneness can be realised directly...not after death but in this life, and this is the purpose for which each of us has been born and the goal towards which evolution moves."