But what was Henry VI doing during the battle? Paul Murray Kendall, for one, leaves the matter in no doubt: "King Henry, whom Warwick had taken with him, was found under a tree laughing and talking to himself" (Kendall, Richard the Third). This portrait, implying a Henry who was clearly demented, has a great deal of appeal for historians like Kendall who are hostile toward Margaret; it shows that Margaret was willing to place England in the hands of a madman to secure her own power.
Contemporary descriptions of the battle, however, are by no means united in their description of Henry's behavior during the battle--indeed, not a single contemporary English source that I have seen describes Henry as laughing and talking to himself during the battle. Here are all of the contemporary or near-contemporary accounts that I know of:
An English Chronicle, edited by John Silvester Davies:
The xij. day of Feuerer, the Thurseday, kyng Harry with his lordes, that ys to say, the duk of Norfolk, and Suffolk, the erles of Warrewyk and of Arundelle, the lorde Bonevyle and other, went oute of Londoun, and came with thayre peple to the toune of Seynt Albonys, nat knowyng that the peple of the North was so nyghe. And whanne the kyng herde that they were so nyghe hym, he went oute and took hys felde besyde a lytelle towne called Sandryge, nat fer fro Seynt Albonys, in a place called No-mannes land, and there he stoode and sawe his peple slayne on bothe sydes. And at the laste, thorow the witbdrawyng of the Kentisshmen with thayre capteyne, called Lovelace, that was in the vaunt-warde,—the whych Lovelace fauored the Northe party, for as moche as he was take by the Northurnmen at Wakefeld whan the duk of York was slayne, and made to theym an othe for to saue his lyfe, that he wold neuer be agayns theym,—and also be vndysposycion of the peple of the kynges syde, that wold nat be guyded ne gouerned by theyre capteyns, kyng Harryes part loste the feeld. The lordes that were wyth the kyng seyng thus, withdrowe theym, and went theyre wey.
Whan the kyng sawe his peple dysparbeled and the feeld broke, he went to his quene Margarete that came wyth the Northurmen, and hyr sone Edward; for thay of the North sayde that thay came for to restore the kyng to the quene his wyfe, and for to delyuer hym owte of pryson; forasmeche as seth the batayle of Northampton he had be vnder the rewle and gouernaunce of the erles of Warrewyk and Salesbury, and of other.
And in the myddys of the batayle Kynge Harry wente unto hys Quene and for-soke alle hys lordys, ande truste better to hyr party thenne unto hys owne lordys.
Registrum Abbatiae Johannis Whethamstede (thanks to Lesley Boatright for the translation out of the Latin):
When they saw this, the (senior and sensible) commanders in the field under the king understood that the king hmself had neither the spirit nor the courage to console or inspire his people – indeed, he could not put a good face on it or find words – but rather in his heart inclined to the reverse. They withdrew to the queen, his wife, hoping in future to have a better day with the enemy, by the grace of the God who instructs hands for battle and fingers for war.
When they had withdrawn, and all the people [= army] had slid away as in flight, there came to the lord king a certain esquire, learned in the law and eloquent enough,  whose name was Thomas Hoo. He suggested to him that he should he should look at and consider the situation in which he now stood: how he was alone, without commanders, without soldiers, without standard-bearers, or any other men-at-arms who should have been at his side for ensuring the safe and secure protection of his body. He should send a suitable man to the army of the Northerners and to the leaders who were in command of them, to tell them that, not only for the said reason, but also because he well knew that they wished him well and had banded together simply for his sake and had come in their strength to these parts, he was ready and prepared to come to them and to remain with them in the same way as he had formerly remained under the command of the Southern lords.
And so, after giving this advice, the said esquire was sent to the army of the Northerners. When he came there, and had revealed the king’s will to the earl of Northumberland, to whom he was very well known, he brought back certain lords with him, and they escorted the king first to the tent nearest the royal castle – that is, the tent of Lord de Clifford. Then they went to fetch the queen and the prince and conducted them both at once into his presence.
When he saw them, he was overjoyed in his inmost heart, just as a betrothed man rejoices over his betrothed, or a father over his son who after he had “perished” was found again and brought again into his presence. He embraced them in his arms, kissing them, and exclaimed at once, “May the Lord God be blessed, who has done such great things in the people of the North that it was enough to restore to us again my wife wrenched away for a time, to drive off all the enemy they met in this, and happily to triumph over the enemy!”
The Crowland Chronicle Continuations:
The northerners then invaded the South and reached St. Albans. The earl of Warwick, who had brought along King Henry as if to make him fight against his wife and son, was put to flight but the northerners failed to follow up their victory and took the king and queen back to the North.
Annales Rerum Anglicarum (from English Historical Documents, Vol. IV, ed. by A. R. Myers)
On Shrove Tuesday . . . took place the battle of St. Albans, where the Duke of Norfolk and the Earls of Warwick and Arundel and many others fled from the field. And King Henry was captured on the field along with Lord Montagu, his chamberlain. And the prince came to the king in the field, where the king, his father, dubbed him knight.
John Benet, from The Wars of the Roses, ed. by Elizabeth Hallam:
The king went out against them, about a mile from the eastern quarter of St. Albans, where the duke of Norfolk, the earl of Warwick and the earl of Arundel fled. They abandoned the king, who was then captured by the other lords.
Calendar of State Papers, Milan, George Neville writing to Francesco Coppino, Bishop of Terni, Apostolic Legate in Flanders, April 7, 1461:
On the 15th of February, as I think your lordship will have learned from others, we had an action with the enemy to our loss, near St. Albans, the details of which would be equally painful and lengthy to narrate, and everyone who heard of it must have been much astonished. However, I think it right to give you a summary account of this battle. The Lord Barni, brother of my lord of Canterbury, together with my brother Lord Montacute and Sir Thomas Carletone, knight, were taken and carried away to York. The strenuous cavalier, Lord de Bonavilla, with the spirited and valiant knight Sir Thomas Bryel were taken and beheaded. I forbear to name the other persons of lower rank who perished; they say that some 3,000 fell on one side and the other; but we, being fortunate, amid so many misfortunes, escaped and lost that puppet of a king (quel idolo del Re) as that statue of a king turned his face towards the North, pillaging in the country, and at length the wife, with her husband, arrived at York, glorying in their very bloody victory.
Calendar of State Papers, Venice, George Nevill, Bishop of Exeter, Chancellor of England, to Francesco Coppini, Bishop of Teramo, in Flanders, April 7, 1461:
As something new has occurred here since your departure, I will write briefly about these events, as learnt by letters, from the lips of messengers, or from common report; although they are much incumbered and perplexed with many important matters.
On the 13th kalends of March (17th February) we fought unsuccessfully near St. Alban's, the details of which action would be too long to narrate, but I think it right to give a summary of the battle. Lord Berners (John Bourchier), brother of the Archbishop of Canterbury (Thomas Bourchier), with my brother Lord Montagu (John Nevill) and Sir Thomas Charleton, Knight, were captured and taken as far as York. Lord de Bonneville and Sir Thomas Kiryel were taken and beheaded, and many of inferior station on our side were destroyed. The loss on both sides amounts to well nigh 3,000 men. We however fled, and lost that puppet of a King—fortunate assuredly in this disaster; whereupon the puppet was carried off northwards and the country ravaged; at length the woman with her consort got to York, big everywhere of their not bloodless and unquestionable victory.
The Great Chronicle of London
And the Quene & hyr party hadd the vyctory & cawsed therle of warwyk & his men to ffle, Soo that kyng henry was lafft soo smally accompanyed, he was there takyn & browgth unto the Quene his wyfe . . .
Calendar of State Papers, Milan, March 9, 1461, Prospero di Camulio, Milanese Ambassador to the Court of France, etc., to Francesco Sforza, Duke of Milan.
The king was placed under a tree a mile away, where he laughed and sang, and when the defeat of the Earl of Warwick was reported, he detained upon his promise the two princes who had been left to guard him. Very soon the Duke of Somerset and the conquerors arrived to salute him, and he received them in friendly fashion and went with them to St. Albans to the queen, and on the morrow one of the two detained, upon his assurance, was beheaded and the other imprisoned.
Jehan de Waurin, Recueil des Chroniques, from English history illustrated from original sources ... 1399-1485, ed. by F. Hermia Durham.
And thus the king was taken under a great oak, where he was laughing greatly at what had occurred, and he begged those who came to him that they should do no hurt to the person of Monsieur Kyriel, which they promised ; but Lovelace, the disloyal traitor, led the king, Sir Thomas, and his son to the queen, who was right glad to meet the king.
So what do we have here? None of the English writers describes Henry as laughing and singing under a tree or as otherwise acting demented. The English Chronicle has Henry, seeing his Yorkist captors scattered, going to his wife. Gregory has Henry deserting to Margaret in the middle of the battle. Whethamsted, the abbot of St. Albans, who played host to Henry after the battle and would have been well aware of his mental state at the time, has Henry being given advice by Thomas Hoo before eventually being escorted to his wife. Crowland simply says that Henry went north after the battle. Annales Rerum Anglicarum has Henry being captured on the field and soon thereafter knighting his son. Benet also has Henry being captured by the queen's men. The Great Chronicle, a later source, has Henry being brought to Margaret. George Neville, Warwick's brother, refers to Henry contemptuously as a puppet but makes no reference to Henry's conduct during the battle.
It is only when we get to Prospero di Camulio, writing from France, and to Jehan de Waurin, a Burgundian chronicler, that the story of Henry laughing and singing beneath the oak tree appears. It's possible, of course, that these two sources are accurately reporting Henry's conduct and that all of the English sources somehow left out this detail, but it seems unlikely, especially given the fact that none of the English sources quoted are sympathetic toward the Lancastrians and surely at least in some cases would have relished recounting a story that showed their king in such a pathetic state.
At any rate, the fact that the laughing-under-a-tree story is reported by only two foreign sources should have made Kendall hesitate before reporting it as an undisputed fact. It didn't, of course, and like so many other dubious stories from the time, it has acquired respectability and staying power thanks to being thoughtlessly regurgitated in popular nonfiction and in historical fiction.