- "- They burned it down. They burned everything.
- Not everything. Not you."
- ―Prince Bran Stark and Maester Luwin
After news of the Fall of Winterfell to a band of ironborn led by Theon Greyjoy and the death of Ser Rodrik Cassel reached Robb Stark, his vassal Roose Bolton, Lord of the Dreadfort offers to send word to his bastard son to gather a force to retake Winterfell. King Robb agrees but demands Theon be kept alive so he can execute him personally.
Some time later, after Lord Bolton reassures him that his son is only a day's ride from Winterfell, Robb orders him to send word to Ramsay that any ironborn who surrenders will be granted mercy, with the exception of Theon. Robb hopes to turn Theon's garrison against him and spare his people and brothers from any retaliation.
After the Northern force reaches Winterfell, a horn is sounded constantly as means of demoralizing Theon and his force. Maester Luwin, bound to serve whoever rules Winterfell, suggests Theon to escape through one of the hidden passageways and flee to the Wall and take the Black. Theon rejects Luwin's counsel and opts for a different plan.
Theon gathers his men in Winterfell's main yard and delivers a speech to them, in which he exhorts them to resist the Northmen and, even though they will all die, attain glory, ending with a frenzied cry of the prayer to the Drowned God: "What is dead may never die". Theon's men respond in various degrees of emotion. After the cry is over, Dagmer Cleftjaw knocks Theon unconscious and tells the men that it's time to go home.
As Theon's men place a hood over his head, Luwin comes out into the yard asking to know what's happening. The sole response Dagmer gives him is a spear thrust to the stomach.
Bran and Rickon Stark emerge from the catacombs of Winterfell, where they had hidden with their protectors Osha and Hodor, to find Winterfell covered in smoke and dying flames and its people dead. They also find Summer and Shaggydog on the gates of the godswood and enter it, only to find an injured Luwin beside the weirwood heart tree. Luwin urges Bran and Rickon to go north to the Wall so their half-brother Jon can keep them safe. As they set to leave Luwin tells Osha to protect the two boys and then asks her to mercy-kill him. Afterward, the four leave the home of House Stark.
Despite having sworn them safe passage, Ramsay Snow flippantly broke his promise, and flayed all of the ironborn alive anyway. All, that is, except for Theon, whom he brought to the Dreadfort's dungeons for prolonged and sadistic torture.
Ramsay subsequently sent false reports to his father Roose via messenger-raven, claiming that it was the ironborn who had burned out Winterfell. In reality, the Boltons (father and son) long in advance - since the Lannisters won the Battle of the Blackwater and it became apparent that they would probably win the war. Ramsay's deception kept King Robb and his mother Catelyn from realizing that it was truly Ramsay and his Bolton soldiers who burned Winterfell. Robb had no idea that the Boltons had turned on him until months later at the betrayal of the Red Wedding, when Roose personally drove a dagger through his heart.
In the books
In the A Song of Ice and Fire novels, the Sack of Winterfell takes place in a different manner. The Northern forces are rallied by Ser Rodrik Cassel, while the ironborn refuse to yield, as Theon takes the people of Winterfell hostage and threatens to hang them one by one if the Northern host doesn't disperse, starting with Rodrik's daughter, Beth. The fate of the siege is decided when a host of men gathered by Theon's collaborator, a Northman known only as "Reek", arrives. Though his force is outnumbered four-to-one, Ser Rodrik's forces thought them to be friends and were slaughtered in a surprise attack. Theon, believing himself saved, opens the gates and allows them inside. "Reek" turns out to be none other than Ramsay Snow, who orders his forces to kill everyone in Winterfell and put it to the torch. By the end of the siege, Winterfell is burned and most of its people massacred, though Bran, Rickon, Hodor and Osha still escape, while Theon and some residents of Winterfell are imprisoned by Ramsay.
- The Sack of Winterfell at A Wiki of Ice and Fire (MAJOR spoilers from the books)