The Dullahan is a headless spirit in Darby O'Gill and the Little People. He was summoned by the Banshee to take Darby O'Gill's daughter, Katie but to save her, Darby wished from King Brian for the Dullahan to take him instead. But King Brian tricked Darby into making a final fourth wish ("wishing" that his friend could join him in the afterlife). Because he was only allowed three wishes, this negated all the previous wishes and spared Darby's life. Darby was saved and King Brian had (literally) the last laugh in their running battle of wits. Luckily, King Brian was so clever he could get out of the Otherworld.
Dullahan, also called Gan Ceann, means "without a head" in Irish.
In Irish mythology, the dullahan is a headless rider, usually on a black horse who carries their own head under one arm. The head's eyes are small, black, and constantly dart about like flies, while the mouth is constantly in a hideous grin that touches both sides of the head. The flesh of the head is said to have the color and consistency of moldy cheese. The dullahan uses the spine of a human corpse for a whip, and their wagon is adorned with funeral objects (e.g. candles in skulls to light the way, the spokes of the wheels are made from thigh bones, the wagon's covering made from a worm-chewed pall or dried human skin). When the dullahan stops riding, that is where a person is due to die. The dullahan calls out their name, at which point they immediately perish.
While he was writing The Legend of Sleepy Hollow, Washington Irving took inspiration from the Dullahan of Irish legend and transplanted it into the Headless Horseman.