At the end of "The Legend of Sleepy Hollow",the author gives several explanations for what happened to Ichabod Crane.
Use specific details from the text that support the inference that the "headless horseman" was a trick played on Ichabod that scared him from Sleepy Hollow.
Ichabod Crane was well known in the community to believe in witches and goblins and the story of the Headless Horseman. He had a copy of Cotton Mather's book on witchcraft and:
His appetite for the marvellous, and his powers of digesting it, were equally extraordinary; and both had been increased by his residence in this spellbound region.
No doubt Brom Bones knew about his wild imagination and figured he could pull off a great prank and get rid of his rival for Katrina's hand in marriage.
There is a lot of foreshadowing about Brom Bones and his skill as a horseman, plus Brom told the story of having escaped the Headless Horseman himself, so he was familiar with the particulars of the legend and how to pull off such a prank.
He was famed for great knowledge and skill in horsemanship, being as dexterous on horseback as a Tartar.
Also, Brom was a big jokester, so it makes sense he would pull a prank on Ichabod:
He was always ready for either a fight or a frolic; but had more mischief than ill-will in his composition; and, with all his overbearing roughness, there was a strong dash of waggish good humor at bottom.
He was, in fact, noted for preferring vicious animals, given to all kinds of tricks, which kept the rider in constant risk of his neck, for he held a tractable well-broken horse as unworthy of a lad of spirit
When Ichabod leaves the Van Tassel farm dejected because Katrina has spurned his advances, he sees the Headless Horseman at the very same bridge where Brom told his story of escaping the Horseman:
He affirmed that, on returning one night from the neighboring village of Sing Sing, he had been overtaken by this midnight trooper; that he had offered to race with him for a bowl of punch, and should have won it too, for Dare-devil beat the goblin horse all hollow, but, just as they came to the church bridge, the Hessian bolted, and vanished in a flash of fire.
When Ichabod is chased by the ghost, he says:
He recollected the place where Brom Bones’s ghostly competitor had disappeared. “If I can but reach that bridge,” thought Ichabod, “I am safe.”
Finally, after Ichabod disappears, whenever the story comes up, Brom Bones knows more than he is telling:
Brom Bones too, who shortly after his rival’s disappearance conducted the blooming Katrina in triumph to the altar, was observed to look exceedingly knowing whenever the story of Ichabod was related, and always burst into a hearty laugh at the mention of the pumpkin; which led some to suspect that he knew more about the matter than he chose to tell.