I understand why the Lord (Walder Frey)
killed Robb Stark
in the events of 'The Red Wedding', but why did he go to the extent of
Is it ever explained??
Partly, it was political, and partly is was personal, and partly it was because he's a psychopath.
On a personal level, Lord Frey had been insulted by Robb backing out on his promise to marry one of his daughters. Since that would have put Frey's grandchild in line for the throne, that kind of promise carries a lot of weight, and breaking was considered a gigantic faux pas on Robb's part even if you ignore the political ramifications.
On a mental level, Walder Frey is clearly out of control. He's pretty consistently portrayed in the novels as being cruel and a little off his rocker. His actions at the Red Wedding, even given what was done to him, are so unbelievably over the top that even his allies are afraid of being associated with him.
But mostly, it was political. Tywin had bribed him to remove Robb Stark from contention for the throne, either the Iron Throne or even just the throne of the North. To do so, Walder had to make sure that he killed Robb in a way that would bring his entire army to heel, very quickly, with no chance of retaliation. So, he killed:
Note that, as far as Walder Frey knew at the time, Robb was the last living Stark child, so his unborn son was the last possible heir to the Stark lineage. (The Lannisters already had Sansa hostage, and the others were believed to be dead.)
(Novel Note: in the novels, the character of Robb's wife is very different, and she is not killed at the Red Wedding; she's taken hostage by the Lannisters, in part because her mother was an accomplice to the whole plot. However, she is also not pregnant, as her mother goes to great pains to assure Tywin.)
The brutality of the whole scene was a message to Robb's allies and bannermen that the fight was over, that there was no one left to lead them, and that if they persisted in fighting back they would be butchered as well.
The enemy of my enemy is my friend
The motivation of the 'Red Wedding' on the part of Walder Frey was to curry favour with (what he thought was going to be) the winning side - The Lannisters.
Much of the planning though was done by our old mate, Roose Bolton. Roose is:
cautious, intelligent, ruthless, and easily capable of unspeakable cruelty.
-Roose Bolton's Wikia Page.
The entire 'Red Wedding' plot was devised as a way of ridding Westeros of "The King in the North" and all of his supporters.
To be the best, you must train with the best
The plot was devised with background support of Lord Tywin Lannister, who himself is credited to having extinguished two noble houses (before he was even the Lord) - the Reynes of Castamere and the Tarbecks of Tarbeck Hall.
This event was known as the Reyne-Tarbeck Rebellion. After Tywin extinguished House Reyne, the Lannisters' infamous unofficial song "The Rains of Castamere" was birthed - this was the same song which was played during the massacre.
In essence, Walder Frey and Roose Bolton have followed suit. Remember when Tywin told Tyrion:
“Some battles are won with swords and spears, others with quills and ravens.
-A Song of Ice and Fire: Book Three - A Storm Of Swords, Chapter Four (Tyrion I).
These are the "letters" which he had been sending via Raven-Post. And you know what they say:
The best predictor of future behavior is past behavior ... Or is it?
In the past, there have been other well-known rebellions - most notably by the Blackfyre Pretenders.
After the First Blackfyre Rebellion, the pretenders were allowed to live in exile. But this proved to not have been the "best" course of action, as eventually the remainder of the Blackfyre pretenders launched a further four rebellions - five in total; up until as recently as the War of the Nine-Penny Kings.
Tywin has essentially learned that had they been exterminated, they would not have been so indignant on usurping the Throne - he has learned from historical "mistakes": destroy the entire line, and you guarantee that there won't be any more rebellions.
By killing Robb's wife and son he basically exterminates the Starks. As far as they knew, Bran and Rickon are also dead. This leaves only the female Starks, Sansa and Arya (Jon is illegitimate, so is not a real Stark). Sansa being the eldest is now heir to Winterfell, and by marrying her off to Tyrion Lannister it ensures that her lands will end up being a Lannister property. Arya's whereabouts are unknown, so that leaves no one left for the Northeners to rally behind. It effectively, and ruthlessly, wins the war against the North.
"Family present" didn't account for much. In the show it was Rob, his wife (and unborn child) and Kat. In the book
The wife wasn't there and may not have been pregnant.
Everybody else that was killed at the wedding was a servant, soldier or otherwise unrelated (by blood) to the Starks (though some may have been Tully's and would not have had a claim on the North).
That said, Robb was lord/King of the North. His wife and or mother could, as a dead lord's widow, hold the claim for one or more of her children. By eliminating as many Starks as possible in one maneuver, the Freys, Boltons and Lannisters eliminated as much possibility of another heir to the Stark line popping up and reclaiming the North in the future as was effectively possible at the time.
In the book it isn't exactly spelled out, but Tywin Lannister mentioned something about it shortly after taking back his role as Hand. "Some battles are won with armies, and some are won with letters" I believe is what he said. One of said letters was to Walter Frey, but the observer (Tyrion, I think) did not know the contents of the letter. It wasn't long after that when the Red Wedding took place. I believe that this timeline was preserved in the TV show as well, but it's pretty subtle and easy to miss.
So basically, between the lines, Tywin Lannister knew that Walter Frey was angry at Robb Stark for not marrying his daughter, he knew that it was a major affront, and used that to his advantage. That's how you win wars. Especially against enemies that you can't beat on the battlefield.