Assassinations at the Twins

"My name is Arya Stark. I want you to know that... the last thing you're ever going to see is a Stark smiling down at you as you die."

- Arya Stark to Walder Frey, just before cutting his throat.

The Assassinations at the Twins is an event late in the War of the Five Kings in which Lord Walder Frey, the Lord of the Crossing, Lord of Riverrun, and Lord Paramount of the Trident, as well as his sons "Lame Lothar" Frey and "Black Walder" Rivers, are murdered by Arya Stark, who was previously believed to be dead. The death of these three individuals avenges the Red Wedding for the Stark family. Although the assassinations of Black Walder and Lothar are not shown onscreen, the death of Lord Walder is depicted in the episode "The Winds of Winter".

Prelude
"For 300 years, we kissed Tully boots!"

- Walder Frey to his sons

Since the War of Conquest, House Frey of the Twins has been a vassal of House Tully of Riverrun, the Lords Paramount of the Trident. However, for their loyalty towards the Iron Throne - in reality, House Lannister - and for their actions during the Red Wedding in which Lord Walder Frey oversaw the massacre of King Robb Stark, Queen Talisa Stark, and Lady Catelyn Stark, as well as the Northern armies, Walder Frey is rewarded with Riverrun and is made the lord of the Riverlands. During the Northern campaign, House Tully had allied with House Stark in securing independence for both the North and the Riverlands.

Meanwhile, Arya Stark was widely believed across Westeros to be dead. In reality, however, she escaped across the Narrow Sea to the Free City of Braavos, where she trained to become an assassin of the Faceless Men. Though she was able to learn some of their techniques and magic, she ended up leaving the guild, refusing to give up her identity (which is a requirement of its members).

Events
"They weren't easy to carve. Especially Black Walder."

- Arya Stark to a shocked and disgusted Walder Frey

After leaving the Faceless Men, Arya Stark returns to Westeros where she intends to continue crossings names off her death list. She eventually finds her way into the Twins, disguised as a servant girl during a banquet being held by the Freys with the Lannisters for their victory at the Second Siege of Riverrun. At some point after the feast, Arya murders Lord Walder's sons, Lothar Frey and Walder Rivers, and has them cooked into pies, which she later served to Walder Frey.

While Walder eats the served pies, he notes that the servant girl is not one of his. He then asks aloud where his "moron sons" are, to which the servant girl replies that they are "already here" - indicating that they are in the pies. When Walder Frey realizes the horrible truth, Arya reveals herself. She taunts him, saying the last thing he will ever see is a Stark smiling down at him as he dies. She then proceeds to happily cut Walder Frey's throat.

Aftermath
With Walder Frey, Lothar Frey, and Walder Rivers dead, the Red Wedding - in which her brother, mother, and pregnant sister-in-law were murdered - has been avenged by Arya Stark.

It is not entirely clear who the new head of House Frey will be, as it is currently unknown if Walder's eldest son, Ser Stevron Frey, is still alive. It is possible that due to Walder's many children, the line of succession will not be clear, potentially throwing the house - and the Riverlands - into even more chaos.

If there is a succession crisis, resolving this chaos will likely take precedence over loyalties to House Lannister, which would mean that newly crowned Queen Cersei Lannister loses access to Riverlands soldiers. Even if the crisis is brief, there is no guarantee that the new Lord or Lady Frey would share his/her father's loyalty to House Lannister. This would be disastrous for Cersei, especially after her recent actions, as House Frey is, for now, the only extant Great House that has not sworn allegiance to either Daenerys Targaryen or the Kingdom of the North.

In the books
In "A Song of Ice and Fire" novels, at least six Freys have been killed so far as payback for the Red Wedding: Unlike in the show, Arya had nothing to do with the above killings; none was committed at the Twins; Lord Walder Frey is not one of those who ate from the Frey pies; he, Black Walder and Lothar are still alive by the point the books reached.
 * Petyr Pimple, Merrett and Ryman have been hanged by the Brotherhood without Banners.
 * Of those, Ryman is the only who actually took part in the massacre (he killed Dacey Mormont), while Petyr and Merrett's part was limited to getting Greatjon Umber too drunk to fight - but such minorities wouldn't bother the Brotherhood, led by their new vengeful leader (Lady Stoneheart) who replaced Beric Dondarrion.
 * Ryman's death made his son Edwyn the heir of the Twins.
 * Jared, Rhaegar and Symond mysteriously disappear on their way from the White Harbor to Winterfell, to participate in Ramsay's wedding, and are never found.
 * Hosteen and Aenys Frey grow worried about the absence of their kin, and ask the Boltons to look for them. Ramsay and his men ride back to where Lord Manderly claims they parted ways, but in vain. Roose speculates that since Lord Manderly’s litter moves very slowly, and his health does not permit him to travel more than a few hours a day, with frequent stops for meals - the missing Freys were anxious to reach Barrowton and be reunited with their kin, so they rode on ahead. Ramsay is not overly concerned with his failure to find them, dismissing the whole matter with "The world won’t miss a few Freys. There’s plenty more down at the Twins should we ever have need of one".
 * It is speculated (and supported by Arya's deed in "The Winds of Winter") that Lord Wyman Manderly had them killed and baked them into the three pies he brings to Ramsay's wedding, to avenge his son's death. He made sure that Roose and the two attending Frey officers - Hosteen and Aenys - would eat from the pies, then, for good measure, asked Abel the bard (actually Mance Rayder) to play the song about the Rat Cook.
 * Lord Manderly has not violated the guest right by killing those Freys, although they were his guests for a while: when asked by Ser Hosteen where they are, he answers innocently "The road has many dangers, ser. I gave your brothers guest gifts when we took our leave of White Harbor. We swore we would meet again at the wedding" - thus, by giving the three Freys "guest gifts", they were no longer protected by the guest right, and he was free to kill them.

It is not mentioned in the books how Lord Frey reacted to the deaths of Petyr, Merrett and Ryman, and to the disappearance of  Jared, Rhaegar and Symond.