A: Some of the responders here give a mechanistic or scientific answer based on biology, neurophysiology, or even the possibility of creating artificial consciousness! – no doubt led by the word ‘how’ in the question.
How consciousness works is a superfluous, out-of-the-blue question. It works and works perfectly well. As to what consciousness is, this is at once a common-sense matter and a metaphysical one being on a par with existence itself – what is existence? We don’t ask how existence works, do we?
Existence IS. Consciousness IS. Whether they are a mystery or not, you will have to investigate…. but not scientifically.