Orgon's family is up in arms because Orgon and his mother have fallen under the influence of Tartuffe, a pious fraud (and a vagrant prior to Orgon's help). Tartuffe pretends to be pious and to speak with divine authority, and Orgon and his mother no longer take any action without first consulting him.
Tartuffe's antics do not fool the rest of the family or their friends; they detest him. Orgon raises the stakes when he announces that he will marry Tartuffe to his daughter Mariane (already engaged to Valère). Mariane, of course, feels very upset at this news, and the rest of the family realizes how deeply Tartuffe has embedded himself into the family.
In an effort to show Orgon how awful Tartuffe really is, the family devises a scheme to trap Tartuffe into confessing to Elmire his desire for her. As a pious man and a guest, he should have no such feelings for the lady of the house, and the family hopes that after such a confession, Orgon will throw Tartuffe out of the house. Indeed, Tartuffe does try to seduce Elmire, but their interview is interrupted when Orgon's son Damis, who has been eavesdropping, is no longer able to control his boiling indignation and jumps out of his hiding place to denounce Tartuffe.
Tartuffe is at first shocked but recovers very well. When Orgon enters the room and Damis triumphantly tells him what happened, Tartuffe uses reverse psychology and accuses himself of being the worst sinner:
Oui, mon frère, je suis un méchant, un coupable.
Un malheureux pécheur tout plein d'iniquité
(Yes, my brother, I am a sinner, a guilty man,
An unhappy sinner full of iniquity) (III.vi).
Orgon is convinced that Damis was lying and banishes him from the house. Tartuffe even gets Orgon to order that, to teach Damis a lesson, Tartuffe should be around Elmire more than ever. As a gift to Tartuffe and further punishment to Damis and the rest of his family, Orgon signs over all his worldly possessions to Tartuffe.
In a later scene, Elmire takes up the charge again and challenges Orgon to be witness to a meeting between herself and Tartuffe. Orgon, ever easily convinced, decides to hide under a table in the same room, confident that Elmire is wrong. He overhears, of course, Elmire resisting Tartuffe's very forward advances. When Tartuffe has incriminated himself beyond all help and is dangerously close to violating Elmire, Orgon comes out from under the table and orders Tartuffe out of his house.
But this wily guest means to stay, and Tartuffe finally shows his hand. It turns out that earlier, before the events of the play, Orgon had admitted to Tartuffe that he had possession of a box of incriminating letters (written by a friend, not by him). Tartuffe had taken charge and possession of this box, and now tells Orgon that he (Orgon) will be the one to leave. Tartuffe takes his temporary leave and Orgon's family tries to figure out what to do. Very soon, Monsieur Loyal shows up with a message from Tartuffe and the court itself – they must move out from the house because it now belongs to Tartuffe. Dorine makes fun of Monsieur Loyal's name, mocking his fake loyalty. Even Madame Pernelle, who had refused to believe any ill about Tartuffe even in the face of her son's actually seeing it, has become convinced by this time of Tartuffe's duplicity.
No sooner does Monsieur Loyal leave than Valère rushes in with the news that Tartuffe has denounced Orgon for aiding and assisting a traitor by keeping the incriminating letters and that Orgon is about to be arrested. Before Orgon can flee, Tartuffe arrives with an officer, but to his surprise the officer arrests him instead. The officer explains that the enlightened King Louis XIV—who is not mentioned by name—has heard of the injustices happening in the house and, appalled by Tartuffe's treachery towards Orgon, has ordered Tartuffe's arrest instead; it turns out that Tartuffe has a long criminal history and has often changed his name to avoid being caught. As a reward for Orgon's previous good services, the King not only forgives him for keeping the letters but also invalidates the deed that gave Tartuffe possession of the house and all Orgon's possessions. The entire family thanks its lucky stars that it has escaped the mortification of both Orgon's potential disgrace and their dispossession. The drama ends well, and Orgon announces the upcoming wedding of Valère and Mariane.

Question: What does the King do at the end of the story?
Answer: Orders Tartuffe arrested, forgives Orgon for the letters, returns the house to the family
Alternative answer: orders that Tartuffe be arrested