Assassination at the Tower of the Hand

The Assassination at the Tower of the Hand is an event in the War of the Five Kings. It is set in motion by the liberation of Tyrion Lannister by his brother, Jaime Lannister, which ultimately leads to the assassination of their father, Tywin Lannister, Hand of the King and Protector of the Realm.

Prelude
"The gods have made their will known. Tyrion Lannister, in the name of King Tommen of the House Baratheon, First of His Name, you're hereby sentenced to death."

- Tywin Lannister passes the sentence.

Tyrion is put on trial for the murder of his nephew, King Joffrey. Realizing the whole spectacle is a rigged farce, he demands a trial by combat instead. However, his champion Oberyn Martell is defeated and killed, and therefore Tyrion is deemed to be guilty. He is sentenced to death by his father Tywin. In the middle of the night on the eve of his execution, his brother Jaime suddenly enters his cell and frees him. Jaime instructs Tyrion that Varys will help him escape the city, and the two brothers hug and say goodbye. Instead, Tyrion decides to confront his father in the Tower of the Hand before leaving the city.

From scapegoat to kinslayer
Tyrion enters the tower through a secret passage in the floor, and is shocked to find Shae in his father's bed. Shae sleepily calls out "Tywin, my lion", the name she had previously called Tyrion. When she spots him she grabs a dagger and they struggle. Tyrion disarms her and strangles her to death with the golden chain that he previously gave her (in the episode The Bear and the Maiden Fair, S3E07)  around her neck. He immediately feels regret and apologizes to her corpse for what he has just done.

Tyrion takes Joffrey's crossbow from the wall and finds his father sitting on the privy. Tywin correctly intuits that Jaime released him, because "he always had a soft spot for you". He reassures Tyrion that he would never have allowed him to be executed, but enrages his son by dismissing Shae as a whore. Tyrion warns him not to call her that again. He demands to know why Tywin sentenced his own son to death, despite knowing that he did not kill Joffrey. Tywin does not answer, and again tries to placate Tyrion. But when he nonchalantly refers to Shae as a whore again, Tyrion shoots him in the stomach. Stunned, a wounded Tywin hisses "you are no son of mine". Tyrion retorts that he is, and always has been, Tywin's son. He reloads the crossbow and shoots his father in the heart, killing him.

Aftermath
"What have you done?"

- Varys to Tyrion Lannister

Tyrion goes to Varys' chambers, and Varys knows he has done something horrible. Varys loads him into a crate, and the crate is loaded onto a ship for the Free Cities. Varys walks away from the ship, then hears the bells tolling from the Red Keep, announcing Tywin's death. Varys turns around and boards the ship with Tyrion.

In the books
In the A Song of Ice and Fire novels, the assassination of Tywin is described in Chapter 77 of Volume Three, A Storm of Swords​. The basic details are the same in the TV series, though the motivations are drastically different:
 * Jaime sneaks into Varys's room and threatens him with a knife, forcing him to help Jaime release Tyrion. This is revealed in a flashback at Volume Four "A Feast for Crows".
 * After Jaime rescues Tyrion from the cell, the two brothers have a talk about Tysha, Tyrion's first wife, whose story was revealed in the episode "Baelor" in the TV series.  Jaime confesses that Tysha was no whore, instead of what Tyrion was told previously, and that Tywin instructed him to tell this lie to give Tyrion a lesson. Tyrion realizes that Tysha had been genuinely in love with him, and becomes furious with Jaime. He swears that Jaime, Cersei and their father will pay dearly. He also tells Jaime that Cersei that has been sleeping with other men, among them Lancel, Osmund Kettleblack (a knight in Cersei's service and a member of the Kingsguard), and, sarcastically, Moon Boy the court jester. Tyrion falsely admits to killing Joffrey to spite Jaime.
 * Tyrion is led by Varys through secret passages before killing Tywin; when Tyrion wants to confront Tywin, Varys begs him not to do something so foolish and dangerous when he is so close to freedom, but indicates him the secret passage to the Tower of the Hand.
 * There are two guards, Red Lester and Lum, who guard the apartments of the Hand of the King when Tyrion sneaks into them. Luckily for Tyrion, the guards do not notice him because they are too busy making jokes about Shae and arguing whether Tyrion will face his executioner bravely or beg for mercy.
 * Tyrion emerges from the secret passage at the hearth in the bedroom of the Tower of the Hand.
 * Shae tries to save herself by claiming that she did not mean what she said in the trial, and that Tywin and Cersei forced her to. In a flashback at "A Feast for Crows" it is revealed to be a lie: Cersei offered Shae a bribe for her false testimony.
 * Shae never attempts to attack Tyrion; he kills her when she calls him "my giant of Lannister". The manner of the killing is the same, though the chain that Tyrion uses to strangle her is a necklace composed of golden hand-shaped segments, which serves as the badge of office worn by the Hand of the King that Tyrion and Tywin successively used in the books, and it is the only thing Shae is wearing at the moment. In the TV series the badge for the Hand is changed to a hand-shaped brooch, thus the chain used here is accordingly changed to the one that Tyrion previously gave Shae.
 * Tywin figures that it was Varys, not Jaime, who released Tyrion, and says "I'll have his head for this".
 * Tywin tries to save himself by saying "You are not to be killed, if that is what you fear. It's still my intent to send you to the Wall, but I could not do it without Lord Tyrell's consent. Put down the crossbow and we will go back to my chambers and talk of it". Tyrion either does not believe or does not care if it is true, being mistreated by his father so long and especially recently. It is doubtful whether Tywin really needed the approval of Mace Tyrell, who had nothing to do with the offer that was given Tyrion during the trial.
 * Tyrion confronts Tywin about Tysha. After he finds his father in the privy he inquiries about her the whereabouts. Tywin doesn't remember her name (or pretends that he doesn't, as an insult) until Tyrion refers to her as his first wife, and recalls her as Tyrion's "first whore". Tyrion promptly warns his father, "The next time you say that word, I'll kill you" (he gives the same warning in the TV series, but referring to Shae instead). Tywin cannot recall, simply stating that she was paid and the steward sent her on her way "wherever whores go". Hearing this, Tyrion looses his crossbow at him.
 * Tyrion kills Tywin with a single bolt to the pelvis, which causes his bowels to loosen. Tywin says incredulously "you shot me", and Tyrion says sarcastically "You always were quick to grasp a situation, my lord. That must be why you're the Hand of the King". The narration remarks that the often repeated jape about Tywin was another, lie as he, in the end, "did not shit gold."
 * The account of the assassination concludes with Tywin's death. The escape of Tyrion and Varys are not depicted. From later volumes we know that Tyrion finally succeeds in escaping, while Varys disappears from the book after he indicates Tyrion the secret passage, and for a quite long period his whereabouts are unknown.
 * Tyrion is not smuggled to the ship in a crate. When the ship reaches its destination, he is bundled into a barrel.
 * Following Tyrion's escape, his loyal squire Podrick Payne leaves the city in search for him. Pod hears from Brella, the only of Sansa's maids who was not a spy of Cersei, that Brienne looks for Sansa. Pod goes after Brienne and eventually joins her, hoping that finding Sansa will lead to Tyrion.
 * There is a foreshadowing of Tywin's death in the First Volume "A Game of Thrones" and the TV episode "Baelor": after Tyrion tells the story about Tysha (still unaware that she was not a whore), Bronn comments "I would have killed the man who did that to me".