Tartuffe ends just like a good old-fashioned comedy should: happily. The villain is carted off to jail. The lovers get married. Wrongs are righted. Justice is served. The truth prevails. This is all pretty standard stuff. There is, however, one element to the ending that requires a little more analysis. The only reason why Tartuffe can end happily is because of the King. Let's call him King Deus Ex Machina. The name fits because that's exactly what the King is. Deus ex machina literally means "god from the machinery." It's a technique borrowed from ancient Greek theater; plays would often be resolved when a "god" was lowered onto the stage in order to mete out justice or zap people with lightening bolts or whatever Greek gods do. In this case, the King, "who sees into our inmost hearts/And can't be fooled by any trickster's arts" sees right through Tartuffe's scheme and saves Orgon from prison or exile (5.7.19). He's the embodiment of all the virtues that Cléante loves to talk about:
He honors righteous men of every kind,
And yet his zeal for virtue is not blind,
Nor does his love of piety numb his wits
And make him tolerant of hypocrites. (5.7.19)
In short, the King is a world-class wise man. He puts everything in its right place. Not only does he nail Tartuffe for the stuff he's done to Orgon, but he also exposes Tartuffe's criminal past. Oh, and he commends Orgon for his "loyal deeds in the late civil war" (5.7.19). So we can leave the play knowing that Tartuffe is getting what he deserves and that Orgon really isn't a total idiot. He's just maybe going a little soft in his old age.
Cléante gets the last words in before the curtain drops. When Orgon curses Tartuffe, Cléante stops his brother-in-law, saying:
Leave the poor wretch to his unhappy fate,
And don't anything to aggravate
His present woes; but rather hope that he
Will soon embrace an honest piety,
And mend his ways, and by a true repentance
Move our just King to moderate his sentence. (5.7.25)
So, we end the play on a happy note. No one, Cléante says, not even Tartuffe, is irredeemable. There can be no happier ending than that.