The ending of The Dark Knight is Batman choosing to be hated so that Gotham can keep believing in Harvey Dent. After the ferry plot fails, the Joker is captured and tells Batman that Dent's fall proves he has corrupted even Gotham's best man. That is the Joker's argument for the whole film: that anyone will break if the pressure is right.
Batman's answer is to carry the damage himself. Dent dies after taking Gordon's family hostage, Batman saves Gordon's son, and then Batman persuades Gordon to hide the truth, taking the blame for Dent's crimes. The city mourns Dent as a hero, and the police launch a manhunt for Batman.
Two small moments finish the argument: Alfred burns a letter from Rachel that said she had chosen Dent, and Fox destroys the surveillance network. Both are acts of mercy and restraint. Alfred spares Bruce one more loss, and Fox gives up the sonar tool Batman used to find the Joker, which Fox had only agreed to build for a single night.
In my opinion, this is what separates the film from the more playful entries in the series, and it is the reason the follow up works. Compare it with the earlier Jokers. In Batman (1989), Jack Nicholson's Joker is a rival with a personal grudge against Batman, so the ending is a duel. In The Dark Knight, Heath Ledger's Joker never needs to win a fight. He wants Gotham's people to turn on each other, and the two ferries are where he loses that bet, because neither the civilians nor the prisoners press the button.
Dent's fall is also a correction of how the series had treated Two-Face. In Batman Forever, Tommy Lee Jones plays him as a loud, comic villain beside Jim Carrey's Riddler. Here Aaron Eckhart's Dent is a decent prosecutor first, so his coin toss, which decides who lives among the people he blames, lands as a tragedy rather than a gimmick.
The Dark Knight Rises opens eight years later with Gotham celebrating Dent's memory under a law named for him, Gordon privately holding the secret and Batman gone. It could be argued that the Joker does not lose the argument so much as postpone it, because the whole system now rests on a lie. That is a sharper ending than a clean win, and it is the one I would point newcomers to first.