Assassination at the Tower of the Hand

Prelude
Oberyn Martell is killed during the Trial by combat of Tyrion Lannister, and Tyrion is sentenced to death by his father Tywin. In the middle of the night, while Tyrion is waiting to be executed, his brother Jaime Lannister 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.



Kinslayer
Tyrion enters the tower through a secret passage in the floor, and finds Shae in his father's bed. Shae, initially asleep, calls "Tywin,  my lion", and then briefly opens her eyes and sees Tyrion. She grabs a dagger, but Tyrion disarms her and strangles her to death with her father's necklace around her neck. He immediately feels regret and apologizes for doing so after Shae is dead. He then looks around his fathers room, sees a crossbow, and takes it off of the wall with additional bolts. Tyrion finds his father sitting on the privy. Tywin assumes that Jaime is the one who released Tyrion, and tells Tyrion to put the crossbow down so they can talk, trying to convince Tyrion that he  won't kill him because they are family. Tywin refers to Shae as just a whore, and Tyrion warns him that he will kill him if he calls her a whore again. Tywin says "whore" a second time, and Tyrion shoots him in the stomach with the crossbow, mid-sentence. Tyrion reloads the crossbow and shoots Tywin in the heart, killing him.

Aftermath
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 assassination occurs almost the same as shown in the TV series, except that:
 * After Jaime rescues Tyrion from the cell, the two brothers have a talk about Tysha, Tyrion's first wife, whose story was told in the episode Baelor in the TV series.  Jaime confessed that Tysha was no whore (instead of what Tyrion was told previously). Tyrion realises that Tysha had been genuinely in love with him, and becomes furious with Jaime.
 * Varys takes over Tyrion from Jaime soon after they leave the cell; when Tyrion wants to confront Tywin, it is Varys who indicates him the secret passage to the Tower of the Hand.
 * The affair about Tysha is the motivation of Tyrion to confront Tywin. After he finds his father in the privy he demands to be told what had happened to Tysha. Tywin did not remember, simply stating that she went "wherever whores go". Hearing this, Tyrion looses his crossbow at him.
 * The account about the assassination concludes with Tywin's death. The escape of Tyrion and Varys are not depicted. We know that Tyrion finally succeeds in escaping in later volumes, while Varys disappears from the book after he indicates Tyrion the secret passage, and for a quite long time his whereabouts are unknown.