Charlemagne's army is fighting the Muslims in Spain. They have been there for seven years, and the last city standing is Saragossa, held by the Muslim King Marsile. Threatened by the might of Charlemagne's army of Franks, Marsile seeks advice and his wise man, Blancandrin, councils him to conciliate the Emperor, offering to surrender and giving hostages. Accordingly, Marsile sends out messengers to Charlemagne, promising treasure and Marsile's conversion to Christianity if the Franks will go back to France.
Charlemagne and his men, tired of fighting, accept his peace offer and select a messenger to Marsile's court. Protagonist Roland, Charlemagne's nephew, nominates his stepfather Ganelon as messenger. Ganelon, who fears to be murdered by the enemy and accuses Roland of intending this, takes revenge by informing the Saracens of a way to ambush the rear guard of Charlemagne's army, led by Roland, as the Franks re-enter Spain through the mountain passes.
As Ganelon predicted, Roland leads the rear guard, with the wise and moderate Oliver and the fierce Archbishop Turpin. The Muslims ambush them at Roncesvalles, and the Christians are overwhelmed. Oliver asks Roland to blow his olifant (the word is an old alternative to "elephant", and was used to refer to a hunting horn made from an elephant tusk) to call for help from the Frankish army; but Roland proudly refuses to do so. It is for this reason that Roland is often accused of pride by critics of the 'Song of Roland'.
The Franks fight well, but are outnumbered, until almost all Roland's men are dead and he knows that Charlemagne's army can no longer save them. Despite this, he blows his olifant to summon revenge, until his temples burst and he dies a martyr's death. Angels take his soul to Paradise.
When Charlemagne and his men reach the battlefield, they find the dead bodies of Roland's men, who have been utterly annihilated, and pursue the Muslims into the river Ebro, where they drown. Meanwhile, Baligant, the powerful emir of Babylon, has arrived in Spain to help Marsile, and his army encounters that of Charlemagne at Roncesvalles, where the Christians are burying and mourning their dead. Both sides fight valiantly - when Charlemagne kills Baligant, the Muslim army scatters and flees, and the Franks conquer Saragossa. With Marsile's wife Bramimonde, Queen of Saragossa, Charlemagne and his men ride back to Aix, their capital in France.
The Franks discover Ganelon's betrayal and keep him in chains until his trial, where Ganelon argues that his action was legitimate revenge, not treason. While the council of barons assembled to decide the traitor's fate is initially swayed by this claim, one man, Thierry, argues that, because Roland was serving Charlemagne when Ganelon delivered his revenge on him, Ganelon's action constitutes a betrayal.
Ganelon's friend Pinabel challenges Thierry to trial by combat, in which, by divine intervention, Thierry kills Pinabel. The Franks are convinced by this of Ganelon's treason, thus, he is torn apart by having four galloping horses tied one to each arm and leg and thirty of his relatives are hanged.

Question: How was Roland's stepfather punished for his betrayal?
Answer: he was torn apart by horses