Gandalf leads Aragorn, Legolas, Gimli, and King Th oden to Isengard where they reunite with Merry and Pippin. With Saruman defeated, Gandalf retrieves Saruman's palant r. Overcome by curiosity, Pippin steals a glance into the seeing-stone, and suffers a mental attack from Sauron himself. Gandalf deduces that Sauron will attack Gondor's capital Minas Tirith, so he rides there to warn them, taking Pippin with him because Sauron thinks Pippin is the ring bearer.
Meanwhile, Frodo Baggins and Samwise Gamgee are led by Gollum to Minas Morgul where they witness the Witch-king of Angmar leading an Orc army to drive Denethor's younger son Faramir and his men from Osgiliath. At Gollum's urging, the three begin climbing a precarious stair carved in the cliff face that will take them into Mordor via a 'secret way'. But having overheard Gollum's plot to regain the Ring, Sam keeps a suspicious eye on him. In Gondor, Pippin follows Gandalf's instructions and secretly lights the beacon to signal Th oden to assemble the Rohirrim and come to Gondor's aid.
While helping Th oden gather his forces, Aragorn is approached by Elrond who says Arwen is dying. After seeing a vision of her son she refused to leave Middle Earth. Elrond then gives Aragorn the sword And ril, Isildur's sword Narsil reforged, so he can reclaim his birthright while gaining reinforcements from the Dead Men of Dunharrow. Joined by Legolas and Gimli, Aragorn travels to the Paths of the Dead, recruiting the Army of the Dead with the promise to release them from their curse once they fulfil their oath to Isildur.
Faramir is gravely wounded after a futile effort to retake Osgiliath, and believing his son to be dead, Denethor falls into madness. Gandalf is left to command the city defences against the Orc army led by Gothmog. But as Gothmog's forces eventually force their way into the city, Denethor tries to kill himself and Faramir on a pyre. Pippin alerts Gandalf and they save Faramir, but Denethor leaps to his death from the top of Minas Tirith just before Th oden and the Rohirrim arrive. Initially the Rohirrim have the advantage at the Battle of the Pelennor Fields, but are eventually overwhelmed by the Oliphaunt-riding Haradrim while the Witch-king mortally wounds Th oden. Though Th oden's niece  owyn, having posed as a male soldier, battles and slays the Witch-King with Merry's help, Th oden dies of his wounds. Aragorn arrives with the Army of the Dead, they overcome the Orcs and win the battle. The Dead are released from their curse, and the wounded are tended to. In the Houses of Healing  owyn meets Faramir, and they comfort each other. Aragorn and the other captains of Men decide to lead all who can march upon the Black Gate as a distraction, so Frodo and Sam can get to Mount Doom.
Meanwhile, Gollum manipulates Frodo into leaving Sam behind before they arrive at the tunnel leading to Mordor, and then tricks him into lair of the giant spider Shelob, who paralyses and binds Frodo. Sam arrives and drives Shelob away, but believing his friend to be dead takes Frodo's sword Sting and The One Ring for safekeeping. When he sees Frodo's body being taken by Orcs to Cirith Ungol he realises that Frodo is still alive, and gives chase. Sam rescues Frodo from the Orcs, and returns the Ring to him.
Aragorn's army draw out Sauron's forces and empty Mordor, allowing the exhausted Hobbits to stagger to the volcano, but they're attacked by Gollum when they reach Mount Doom. Frodo finally succumbs to the Ring's power and claims it as his own, and refuses to destroy it. Gollum attacks Frodo and bites his finger off to reclaim the Ring, but Frodo fights back and knocks Gollum (while holding the Ring) into the volcano where the Ring was made. Sam manages to save Frodo. The Ring and Sauron are both destroyed, causing a chain-reaction that consumes the mountain, topples Barad-d r, and kills most of the fleeing Orcs as the ground crumbles beneath them. Gandalf flies in with eagles to rescue the Hobbits, who awaken later in Minas Tirith and are reunited with the surviving Fellowship members.
Aragorn is crowned King of Gondor and takes Arwen as his queen. They, and all others present at his coronation, bow before Frodo and the Hobbits. The Hobbits then return to the Shire where Sam marries Rosie Cotton. Frodo, unable to cope with the traumas of his journey, departs Middle Earth for the Grey Havens with his uncle Bilbo, Gandalf, and the Elves, leaving Sam the Red Book of Westmarch which details their adventures. Though saddened by Frodo's departure, Sam is gladdened by the warm welcome he receives upon returning home.
Output: Why did Denethor go mad?