When Hanuman has both feet in Lanka, he shrinks to a small size and begins looking into the windows of every building for Sita. Several streets in the city are lined with buildings that house Ravana's "collection of women," who are lonely now that Ravana's attention has shifted to Sita. Hanuman comes across a lovely woman lounging in bed, surrounded by attendants. As Hanuman studies the woman, he realizes she's not Sita—this woman sleeps in a clumsy position and talks in her sleep. Hanuman realizes this must be Ravana's wife.
Hanuman's realization suggests an exceptionally high standard of beauty for Sita; in order to be recognizable as Sita, she has to even sleep elegantly. Ravana's collection of women is another way for him to demonstrate his power. He's evidently a convincing figure, as his curse means that all of these women consented to join his harem. This forced morality creates the sense that Ravana isn't all bad, if only because he's sometimes forced to be good.
Hanuman peeks into Ravana's palace and doesn't see Sita there, so he continues his search. He finds himself in one of Ravana's parks, where he sees several rakshasa women with weapons, sleeping around an unkempt Sita. Suddenly, the rakshasa women get up and begin to intimidate her. Ravana arrives and attempts to speak to Sita, alternating between scaring her and offering her luxuries. Through all this, Sita rejects the rakshasas' advances, which fills Hanuman with pride and respect for her.
Even when she's unkempt and attacked, Sita manages to maintain her composure and remains loyal to Rama. A perfect woman (according to the story) is thus supposed to be unwaveringly loyal to her husband, even in the face of death or torture. Sita's loyalty then inspires further loyalty in Hanuman—she leads by example, like Rama does.
Angry that Sita won't give in, Ravana leaves the garden after instructing the rakshasa women to break Sita's will to resist him. The rakshasa women torment Sita for a while longer and then leave her alone. Sita, distraught, prepares to hang herself from a tree, but Hanuman cautiously approaches her and tells her who he is and what Rama's been doing. He shows her Rama's ring, and Sita offers Hanuman a piece of jewelry that she managed to save to pass along to Rama.
Sita's loyalty is rewarded as Hanuman reveals himself to her. He behaves heroically himself, while also showing Sita that Rama has been acting loyally and honorably the entire time. Sita's brief contemplation of suicide is indicative of the fact that she's literally been created to be Rama's companion; life without him is simply not worth living for her.
Before leaving Lanka, Hanuman makes himself monstrously large and destroys parts of Lanka. Hanuman then allows Ravana's son, Indrajit, to capture him and bring him before Ravana. Hanuman tells Ravana that Rama will destroy Lanka and Ravana with it if he doesn't give in, but Ravana orders his army to kill Hanuman. Ravana's brother Vibishana insists that it's wrong to kill a messenger, so they settle for setting Hanuman's tail on fire. Hanuman, however, uses this to his advantage. He escapes and lights parts of Ravana's city on fire, and then returns to Rama.
From his first mention, Vibishana shows that he's surprisingly honorable and good for being related to the evil Ravana. This suggests that good and evil can exist anywhere; good (or evil) is a decision rather than a set state of being. Hanuman then punishes Ravana's vanity and pride in material wealth by setting the city on fire.