The central tragedy of "Dead Poets Society" is the suicide of Neil Perry. After defying his father, Mr. Perry, to star in a local production of "A Midsummer Night's Dream," Neil is confronted by his father, who withdraws him from Welton and enrolls him in Braden Military School to ensure he follows the path to becoming a doctor. Feeling completely trapped and unable to communicate his despair or stand up to his father, Neil takes his own life with his father's revolver. This event is the catalyst for the film's final act.
In the aftermath, Headmaster Nolan launches an investigation to find a scapegoat and preserve the school's reputation. Richard Cameron, a member of the society, betrays his friends to save himself, blaming Mr. Keating entirely for corrupting the boys and causing Neil's death. The other boys are pressured one by one into signing a pre-written letter confirming Cameron's story. Charlie Dalton is expelled for punching Cameron and refusing to cooperate.
In the final, iconic scene, Mr. Keating is fired and comes to the classroom to collect his belongings while Headmaster Nolan is teaching the class in the traditional, rigid Welton manner. As Keating is about to leave, Todd Anderson, who has struggled with shyness throughout the film, finally finds his voice. He confesses that the boys were forced to sign the letter. Despite Nolan's threats, Todd stands on his desk and recites, "O Captain! My Captain!" Several other members of the Dead Poets Society follow suit, standing on their desks in a final act of loyalty and defiance. Keating, visibly moved, simply says, "Thank you, boys. Thank you." The ending is bittersweet; Keating is gone and the system has seemingly won, but the act of the boys standing on their desks signifies that Keating's lessons of individualism and critical thinking have had a lasting impact and his spirit of rebellion will live on in them.