One time the Buddha was living in the Jeta Grove in Anāthapiṇḍika's Park just outside Sāvatthī.  At that time a bhikkhu named Sāti was insisting that consciousness (viññāna; Sanskrit: vijñāna) is what 'wanders through the rounds of rebirth'. The Buddha's response to Sāti tells us much about his understanding of what consciousness is.
Asked what he thinks consciousness is, Sāti says:
Yvāyaṃ, bhante, vado vedeyyo tatra tatra kalyāṇapāpakānaṃ kammānaṃ vipākaṃ paṭisaṃvedetī’’ti
It is that, sir, which speaks and feels, that which experiences the good and bad consequences of actions.
It seems that Sāti may have been a Brahmin of the progressive kind as he is describing something like an ātman. He is suggesting that there is some persistent entity which experiences the fruit (vipāka) of action from life to life. That entity he is calling viññāṇa. His view appears to be that the Buddha may be using the a different word, viññāṇa instead of ātman, but that he teaches more or less the same thing as Yājñavalkya in the Bṛhadāranyaka Upaniṣad. The Buddha is not pleased with Sāti and upbraids him for misrepresenting his teaching. Then addressing the other bhikkhus the Buddha says:
Bhikkhus from whatever condition consciousness arises, it is called that kind of consciousness. Consciousness arising with the eye and form as condition, is called eye-consciousness.
And so on for each of the senses in turn: ear-consciousness, nose-consciousness, tongue-consciousness, body-consciousness, and mind-consciousness. This is just like, he says, the way that there is a difference between a forest fire, a grass fire, a gas fire, and a house fire (to paraphrase a little). Each is fire and requires fuel to be sustained, but one can distinguish differences depending on what fuel is being consumed. We leave out oxygen because the role of oxygen in burning was not understood in any detail and is left out of traditional fire metaphors.
In the case of mind-consciousness the word for mind is 'manas'. Words for mind and consciousness are used quite loosely and interchangeably in the texts, with variations over time, so it's sometimes difficult to pin down what is meant (c.f. mind, consciousness, gnosis, psyche, nous, cognition, subjectivity etc). Manas here is the function of the mind that processes input from the five physical senses; as well as memories, thoughts, associations, speculations and the like which are generated by the mind itself. These mental objects are collectively known as dhammā (plural). What a dhamma is understood to 'be', its ontological status, is vague and changes over time. We may take them to be units of experience.
Here then is the basic Buddhist definition of consciousness - viññāṇa. Consciousness is functional, and always consciousness of some object (note the early Buddhist model of reality allows for a subject and object at least conventionally), there is no subjective consciousness if there is no object of consciousness. This can be difficult to grasp - that consciousness itself is dependent on conditions. I would argue that in fact this is the main point of the Buddha's teaching on dependent origination - the consciousness itself is conditioned.
But what is viññāṇa? Well, this is very difficult to spell out in terms that would satisfy modern criteria for evidence - the nature of consciousness is one of the perennial philosophical questions. Many books have been written on the subject with each contradicting all of the others. I think it is best to adopt a pragmatic approach and say that the Buddha is not trying to provide an absolute definition of consciousness, not trying to set up a philosophical system, but that he is drawing attention to those aspects of consciousness which are important for understanding his method of practice. That is why he defines consciousness in the way that he does, because anything else is irrelevant to Buddhist practice.
Having explained this the Buddha asks:
'this has come to be', Bhikkhus, do you see?
He asks them whether they understand that 'this' depends on food 'āhāra', and ceases when the food ceases. Bhūta is the past-participle of √bhū 'to be' and so means 'become' - it refers to something that has come into existence. This in turn is linked to the idea of yathābhūta - often translated as "things as they are", but means something more like simply "as become", and is said by the tradition to be the content of the Buddha's vision. So the Buddha is trying to get to the heart of the matter.
An interesting facet to this phrase was pointed out to me some years ago by Professor Richard Gombrich in his Numata Lectures in 2006. The form of pronoun used here 'idam' is known as deictic, and refers to something present to the speaker. Professor Gombrich thought that the Buddha might have been pointing to something while talking - perhaps a fire. Is this the first recorded use of a visual aide during a presentation? The fire only burns while there is fuel, and when the fuel runs out the fire goes out. Fire in fact is one of the most important metaphors that the Buddha uses.  Consciousness is like fire because without fuel (an object) it does not continue. Fire spreads and can be seen almost to seek out new fuel, like consciousness seeks out new objects. Sometimes the Buddha also describes 'desire' (taṇha) as the fuel (upadāna) for becoming (bhava); and with the extinguishing (nibbāṇa) of desire comes liberation (vimokkha).
Now the first part of this text can be read as the Buddha proposing paṭicca-samuppāda as an alternative to rebirth, however later he appears to confirm his belief rebirth when he talks about the 'gandhabba' which descends into the womb at conception. Gandhabba used in this sense is unusual and I don't want to get bogged down trying to figure out precisely what it means. It appears to be an entity which ensures the continuity of kamma and vipaka (action and consequence) beyond death.  As soon as one proposes or accepts a theory of rebirth one runs into a deep philosophical problem: what can possibly survive death? How can anything be transferred from a dead person into an embryo separated in time and space? How do the consequences of my actions transcend my own death? Buddhism seems confused on this point, or at best ambiguous and ambivalent. The Pāli texts are clearly contradictory at times: sometimes putting forward a rather deterministic version in which the same person does in fact appear in life after life, as in the Jātaka stories; or in the texts where the Bhikkhus ask after the 'destination' of someone who has died; or when the Buddha recalls his millions upon millions rebirths when he awakens, suggesting that not only consciousness but more specifically memory persists! At other times, as in the first part of this sutta, the idea of anything which persists from moment to moment, let alone life to life, is ruled out - there is only arising in dependence on conditions. It's not clear whether any given text is meant as literal truth, or as pedagogical rhetoric making a broader point, although the idea that even in death one does not escape the consequences of ones actions is ubiquitous. I think this confusion in the early texts is often mirrored by confusion in the present about rebirth. The waters are muddied in our time by the popular Tibetan notion of reincarnating 'tulkus'.  The result is not very intellectually satisfying. So what are we to make of it?
The main thing seems to me to be that consciousness itself arises from causes (eye, and eye object for instance) and it is therefore impermanent. There is not a stream of consciousness, but a series of moments arising in dependence on contact between organ and object. The sense of continuity is an illusion. It is this very strong sense of continuity that leads us towards views which support our continued existence in the future, and this is what, I think, attracts us to the myth of rebirth. The Buddha asks us to forego such speculation and focus on what our mind is like in the here and now - to understand how our minds consume and are sustained by sensory input, like a fire consumes and is sustained by wood, or grass or whatever.
- Mahātaṇhāsaṅkhaya Sutta. MN 38. PTS M i.259. Not translated on Access to Insight. Translated by Ñāṇamoli and Bodhi in The Middle Length Discourses of the Buddha, p.394 ff. All translations in this article are my own.
- For more on the use of the metaphor of fire see: Jayarava Rave - Everything is on fire! and Playing with Fire.
- Ñāṇamoli and Bodhi (p.1233-4, note 411.) point out that the Pāli commentary on this passage suggests that the gandhabba is "a being due to be reborn because of their kamma". The word in this sense occurs only in this sutta (elsewhere it is a kind of celestial musician, often mentioned along with yakkhas and nāgas). The bhikkhus suggest that we think of gandhabba as a "stream of consciousness" but this seems to me to repeat Sāti's error because it posits a continuity of consciousness of the same kind. My opinion is that the section on the gandhabba is a folk belief of the time, and contradicts the early part of the sutta. Trying to explain the mechanics of rebirth almost inevitably leads to contradiction (like time travel in a science fiction story).
- The tulku system in my view is a primarily a political system. It is a unique system of governance in which precocious and promising youngsters are taken and rigorously educated for many years. They are then, if they have lived up to their promise and not all of them do, put in charge - not only spiritually, but politically. The tulku, crucially, inherits not only the charisma (in the Weberian sense) of his predecessor but all of his property and income. In Japan by contrast monks simply started having children and passing monastic property and resources to them. The Tibetans on the whole kept religious leaders celibate and therefore had to find a way of ensuring continuity. This has not entirely eliminated succession conflicts, and disputes over access to resources, but it must have smoothed things over to a great extent.