Most of the evidence available is anecdotal, but the general consensus seems to be that there is no consciousness, or, if there is, it lasts "only a few seconds before the massive drop in cerebral blood pressure causes them to lose consciousness."
It is difficult to study this using modern techniques, as not many (if any?) countries use beheading as a method of execution anymore.
The most often quoted story supporting consciousness after beheading is the 1905 eye-witness report by Dr. Gabriel Beaurieux of a man named Languille.
Here, then, is what I was able to note immediately after the decapitation: the eyelids and lips of the guillotined man worked in irregularly rhythmic contractions for about five or six seconds. This phenomenon has been remarked by all those finding themselves in the same conditions as myself for observing what happens after the severing of the neck
[...] I waited for several seconds. The spasmodic movements ceased. The face relaxed, the lids half closed on the eyeballs, leaving only the white of the conjunctiva visible, exactly as in the dying whom we have occasion to see every day in the exercise of our profession, or as in those just dead. It was then that I called in a strong, sharp voice: "Languille!" I saw the eyelids slowly lift up, without any spasmodic contractions – I insist advisedly on this peculiarity – but with an even movement, quite distinct and normal, such as happens in everyday life, with people awakened or torn from their thoughts.
Next Languille's eyes very definitely fixed themselves on mine and the pupils focused themselves. I was not, then, dealing with the sort of vague dull look without any expression, that can be observed any day in dying people to whom one speaks: I was dealing with undeniably living eyes which were looking at me. "After several seconds, the eyelids closed again, slowly and evenly, and the head took on the same appearance as it had had before I called out.
It was at that point that I called out again and, once more, without any spasm, slowly, the eyelids lifted and undeniably living eyes fixed themselves on mine with perhaps even more penetration than the first time. The there was a further closing of the eyelids, but now less complete. I attempted the effect of a third call; there was no further movement – and the eyes took on the glazed look which they have in the dead.
[...] The whole thing had lasted twenty-five to thirty seconds.
A 1939 issue of JAMA tried to debunk this:
Le Journal indicates that physicians other than Dr. Beauieux were present and says that they came to the conclusion that vital perception lasted no longer than ten seconds after the execution.
[...] The following facts indicate fairly conclusively that conscious processes in the brain of man cease almost simultaneously with the severance of the head from the body:
The brain of man is so dependent on oxygen in the arterial blood and the continued removal of carbon dioxide and other wastes by the capillary circulation in the brain that a few seconds of complete inhibition of the heart procudes unconsciousness and fainting. Circulation of blood in the brain stops at once with teh severance of the head.
A blow directed toward any part of the head, even not severe enough to break any bones of the skull or jaw ("the knockout blow") is known to produce unconsciousness [...]. In beheading a man, the jar to the skull [...] is in all probability as severe as any knock-out blow.
The movements of tongue, jaw, facial muscles, eyelids, or pupils that may occur after beheading are in all probability due to stimulation of the lower reflex centers in the brain by the state of asphyxia and in no wise[sic] indicate conscious processes.
In the case of lower vertebrates (birds, reptiles, frogs, and fishes) in which the brain is less immediately dependent on the oxygen of the arterial circulation, it is known that ordinary reflexes can be elicited through the brain of the severed head for several minutes after such severance.
Less authoritatively, a forum user claiming to be a pilot gives a possible explanation for Dr. Beaurieux's observations using his own experiences with oxygen-deprivation:
While I'm not a doctor, something I wanted to add to this discussion was the experiences I have had in altitude chambers, where we were exposed to oxygen deprevation and hypoxia.
They bring the altitude chamber to 25,000, 30,000, and/or 35,000 feet, depending on the training (I've done all 3) and individuals take turns removing their oxygen masks and trying to function at those altitudes.
One student, a pilot training candidate, took his off at 35,000.
Within approximately 20 seconds, his lips and fingernails were blue (cyanosis), his speech was slurred, and he was having difficulty thinking (we're asked to perform simple tasks, like writing our names, etc).
By 30 seconds, he was no longer responding; however, his eyes were opened and he was looking around. He didn't fall over or pass out. This is normal for hypoxia, though it differs from how Hollywood and the media portray it.
He was told he was "going to die" if he "didn't put his mask on".
After repeated attempts, finally the instructor told the student next to him to put the incapacitated student's mask back on for him.
Before he could do that, one of the other students yelled, "EJECT, EJECT, EJECT!" The hypoxic student immediately started reaching for the ejection handles.
As soon as his mask was back on, the student returned to trying to write his name on the paper and was unaware of what happened inbetween, thus he had no memory of being told he was going to die or that he tried to eject.
I think the lesson here is that there are reflexive responses and there are conscious responses.
In the case of beheading, yelling the victim's name and having him look towards you definitely indicates brain activity on some levels, but the response may be purely reflexive, and does not necessarily indicate that the victim is conscious and aware.
The only article I was able to find that is unrelated to Dr. Beaurieux's account is a 1886 Proges Medical Journal article detailing the study of a single head/body after beheading:
These researches show that not a trace of consciousness remains two seconds after beheading; that reflex movements of the cornea can be excited for a few seconds; that the heart may beat for an hour, the auricles continuing to pulsate alone for half that period; and that, putting aside the reflex movements of the eyelid, the contraction of the jaws and the jets of blood from the carotids, it seemed in this case as though a corpse had been decapitated, so inert were the remains of the convict.
In all of these accounts, it is unknown if the head's actions are due to consciousness or simply reflexes. However, if it is consciousness, it definitely lasts no more than a few seconds.