"The author diverts the Emperor and his nobility of both sexes, in a very uncommon manner. The diversions of the court of Lilliput described. The author hath his liberty granted him upon certain conditions."
The Lilliputian court comes to like Gulliver thanks to his gentle behavior.
Because the Emperor admires Gulliver so much, the Emperor orders his people to put on a couple of shows for Gulliver
The main show is a kind of rope dancing, which is performed only by people who hold high office in Lilliput. In fact, in order to get a high office in Lilliput, you have to beat all the other candidates in this rope dancing competition. Skill at this dance is the main qualification for court positions.
Because the dance involves seeing who can jump the highest on a piece of rope without falling, there are lots of accidents. People try to jump too high or miss the rope and whatnot – and some of these falls are even fatal.
The Emperor also likes to make his court play a kind of limbo. Sometimes his courtiers creep under a stick he's holding and sometimes they jump over. Whoever jumps and crawls the best wins a prize from the emperor: a colored belt, like a karate belt, proving the winner's skills.
Gulliver invents a game to entertain the emperor: he sets up a raised stage using his handkerchief and a set of sticks.
On this stage, he sets a troop of 24 of the Emperor's horsemen to perform their maneuvers and drills.
This game goes on until one of the horses tears through the handkerchief with its hoof and injures itself; after that, Gulliver decides the handkerchief is too weak to support the Lilliputians.
As Gulliver gets busy entertaining the Emperor's court, he hears news that something else has washed ashore: a giant black thing that doesn't seem like a living creature.
It is, in fact, Gulliver's hat, which the Lilliputians drag to the capital. Gulliver is happy to get it back again.
The Emperor (whose sense of humor, we have to admit, seems kind of weak) decides that he wants Gulliver to pose standing with his legs as far apart as they can go.
The Emperor orders his troops to march between Gulliver's legs in rows of 24 men.
Even though the Emperor also tells his armies not to make any comments about Gulliver's body, a bunch of them can't help looking up and laughing.
Gulliver's pants are in such tatters at this point that he's flashing all of the Emperor's armies. There are, he tells us, "opportunities for laughter and admiration" (1.3.7) for the Lilliputians – after all, Gulliver implies, he's a giant, and his penis has to be proportionally huge.
Gulliver lobbies hard to be set free, and finally the whole court agrees, with one exception: Skyresh Bolgolam, who seems to feel he is Gulliver's enemy (Gulliver says, without reason).
Bolgolam at last agrees that Gulliver should be released, but only if Bolgolam can make the conditions for Gulliver's freedom.
The contract for Gulliver's freedom has the following rules:
Gulliver won't leave Lilliput without permission;
He won't come into the main city without the Emperor's permission and two hours of notice (because up until now, he's been chained to that temple just outside the city gates);
The "man-mountain," as they continue to call him, will only walk on the kingdom's main roads, and will not lie down in any meadows or fields;
He will be careful not to stomp on anyone or pick them up without their consent;
Once a month, if there are particularly urgent messages the Emperor wants to send, Gulliver will have to carry the messenger and his horse to his destination and back again;
Gulliver will defend Lilliput against their enemy, the island of Blefuscu;
He will help workmen pick up stones to build walls and royal buildings;
In two months' time, Gulliver will give the Emperor his calculation of how big the island of Lilliput is;
If Gulliver observes all of these rules, the Emperor will provide Gulliver with food, drink, and "access to our royal person" (1.3.18) – in other words, Gulliver will get to spend as much time as he wants with the Emperor. Lucky guy!
Gulliver agrees to all of these rules, even though some of them seem to come from the pointless hatred of Skyresh Bolgolam.
The Emperor permits Gulliver to go free, and his chains are unlocked at last.