The following theory, written by /u/generalzee, suggests that everything you thought you knew about The Joker was actually wrong. This is so crazy that it might actually be true.
Joker, although a lying psychopath, is actually the hero in The Dark Knight. Before the Joker, Gotham was a mess. Entire sections of the city were closed off due to madness, organized crime ran rampant, and the majority of important city officials were wildly corrupt. The city even tolerated a renegade vigilante who ran around wearing a rubber suit (Okay, special armor and carbon fiber, but they don't know that).
Along comes the Joker and by the end of a very short time, almost all organized crime was eliminated, many corrupt officials were imprisoned or dead, and the city's Vigilante even went into hiding for 8 years. This was all part of Joker's masterfully executed plan. Everyone must realize that Joker, despite his claim otherwise, really was "The Man With The Plan" throughout the entire film.
The very first thing we see Joker do is rob a mafia controlled bank, eliminating the entire team of expert bank robbers who helped him pull it off. Of course, the robbery wasn't about the money, it was about luring Lau out of hiding, preferably with all the major crime families' collective money. This works beautifully, and as Joker predicts, Batman goes to Hong Kong to "Extradite" Lau. Now Lau is in a safe place which Joker can, amazingly, access with ease.
This of course is all just the plot of the film, but Joker is playing it amazingly, murdering key criminals and corrupt officials that could help insulate those at the top. Dent actually argues FOR insulating the men on the top in the interest of cleaning the streets of lower-level goons, but Joker knows that won't work in the long-term.
At this point we honestly just have 3 men battling for Gotham's "soul" (as Joker puts it), but Dent and Bruce Wayne are simply playing into Joker's greater plan. This even extends to Joker's threats to destroy a hospital. With Batman and Gordon's help, Joker helps them root out corrupt police officials. Dent even kills some of those officials later in the film.
Gordon's promotion, too, did a major service to Gotham. I think a lot of people take the Joker's clapping during Gordon's promotion scene to be sarcastic, but I actually think that Joker believed in Gordon, one of the few officers on the force who was truly incorruptible.
So now Joker has a pretty clear path to getting rid of the Organized Crime problem and the corrupt officials problem, but the Vigilante problem remains. As we saw at the beginning of the film, Batman was inspiring other vigilantes, and a society cannot stand when each man takes his own justice. This symbol of fear and unbridled vengeance, as Joker sees it, needs to be stopped, but not killed. If he were killed, he would just be a martyr, and his symbol would live on.
Of course, since Dent was a far better symbol for the city, he would make a far better martyr. I don't know if Joker actually intended for Harvey to be so physically scarred by the explosion from which Batman saved him, but I am certain that he wanted Harvey to feel the full pain of Rachel's death, which is why he purposely tells Batman to go to the wrong address.
He knows what Rachel's death would do to Harvey psychologically, and that Batman would eventually have no choice but to kill Harvey. This breaks Batman psychologically, and also makes him a villain, a true villain, the kind that abandons his own principles.
Batman now has no choice but to disappear, leaving his memory to fade into something of urban legend by the time The Dark Knight Rises begins.
When we pick up in the next film we see a defeated Bruce Wayne who had retired 8 years prior. The city was safe and peaceful (until Bane shows up), and doesn't need constant vigilante justice to keep it safe. Joker shows Batman the error of his ways, but does so in a totally devastating way.
Even the display with the two boats at the film's climax only served to prove to the people of Gotham that they wouldn't turn on each other. He proved that there was good even in the most supposedly despicable of Gotham's inmates.
In the end, Gotham is actually clean. But it wasn't because of Harvey, who died too soon to do any good, except as a martyr. And it wasn't because of Batman, who (after the events of the second film) was ostracized and treated like the violent vigilante that he truly is.
Gotham was safe because the Joker had cleaned up the streets.He eliminated the corrupt police, he destroyed organized crime financially, he uplifted Gotham's spirit, and he even got rid of the flying pest that had been corrupting Gotham ever since he declared himself its protector.
Check out more movie trivia in the gallery below.