Highlight for spoilers (explanation of this ep).
Olenna Tyrell poisoned Joffery with the help of Dontos and a mystery partner. The Stranger, was delivered in Sansa's necklace. Dontos was paid to give Sansa the necklace because she wouldnt trust anyone else leading up to the events in the next episode.
The reason is The Tyrells have a firm strangle on the Throne, the Lannisters owe the Iron Bank of Braavos a shitton of money (aaand they always collect their debts, as told in the ep), they have the largest cavalry in Westeros and probably the largest army at this point with some of the greatest tacticians (Sam Tarly of the Nights Watch, yeah his father is a ####ing military mastermind who rapes face). On top of that, they are the richest of the houses at the moment due to the large debt the capital is in and they also hold the largest food supply. Unfortuntely, they have peasant blood. Even their claim on Highgarden is disputed.
Tywin knows he needs the Tyrells so he is willing to marry into them. Enter Maergery.
They dont want Joffery, he cant be controlled. Hes a monster and is just as likely to kill her as he is to give her a baby. They kill him so Tommen - a younger, kinder, more easily manipulated child can take the throne. Cersei has little interest in Tommen so Margery has a blank slate to work with.
Enter Stannisrage.