Harry Potter and the Goblet of Fire

Further information: Plot of the novel
Harry Potter dreams of Frank Bryce, who is killed after overhearing Lord Voldemort discussing plans with Peter Pettigrew and another man. Harry attends the Quidditch World Cup with the Weasleys, but after the game, Death Eaters terrorise the spectators, and the man who appeared in Harry's dream summons the Dark Mark.
At Hogwarts, Albus Dumbledore introduces ex-Auror Alastor "Mad-Eye" Moody as the new Defence Against the Dark Arts teacher. He also announces that the school will host the legendary event known as Triwizard Tournament where three magical schools are going to compete against each other in a very deadly competition by facing three dangerous challenges. The champions are selected by the Goblet of Fire: Cedric Diggory of Hufflepuff is chosen to represent Hogwarts, Viktor Krum will represent Durmstrang Institute, and Fleur Delacour will represent Beauxbatons Academy of Magic. The Goblet unexpectedly chooses a fourth champion: Harry Potter. Dumbfounded, Dumbledore is unable to pull the underage Harry out of the tournament, as the Ministry official Barty Crouch Sr. insists that the champions are bound by a contract, and therefore, Harry is invited to compete. This makes Harry's best friend Ron Weasley jealous of him.
For the tournament's first task, the champions must each retrieve a golden egg guarded by a dragon. Harry succeeds after he summons his broomstick to retrieve the egg, which contains information about the second challenge. Shortly after, another event known as the Yule Ball dance takes place, during which Harry's crush Cho Chang attends with Cedric, and Hermione Granger attends with Viktor, which makes Ron jealous of Viktor. During the second task, the champions are instructed to dive underwater to rescue their mates. Harry comes out in 3rd place but is placed second behind Cedric due to his "moral fiber". Afterwards, Barty Crouch Sr. is found dead by Harry. Harry visits Dumbledore at his office, and while waiting for him, he discovers a Pensieve, which holds Dumbledore's memories. Inside it, Harry witnesses a trial in which Igor Karkaroff (Durmstrang Institute's Headmaster) confessed to the Ministry of Magic names of other Death Eaters, after Voldemort's defeat. He named Severus Snape as one, but Dumbledore defended him; he then named Barty Crouch Jr. Barty Crouch Sr. was left devastated, and his son was taken to Azkaban. After exiting the Pensieve, Harry deduces that the man he has seen in his dreams with Voldemort is Barty Crouch Jr.
In the third and final task, the competitors are placed inside a hedge maze and must reach the Triwizard Cup. Viktor, under the influence of the Imperius Curse, incapacitates Fleur. After Harry saves Cedric when the maze attacks him, the two claim a draw and grab the cup together, which turns out to be a Portkey and transports the two to a graveyard, where Pettigrew and Voldemort are waiting. Pettigrew kills Cedric with the Killing Curse and performs a ritual using a bone of Voldemort's father, Pettigrew's flesh and Harry's blood, which rejuvenates Voldemort, who then summons the Death Eaters. Voldemort releases Harry in order to beat him in a duel to prove he is the better wizard. Harry is unable to defend himself, but tries the Expelliarmus charm at the same moment Voldemort attempts the Killing Curse. Their wands do not work against each other, and Voldemort's wand is forced to disgorge the last spells it performed. This results in shadow impressions of the people he murdered appearing in the graveyard, including Harry's parents and Cedric. This provides an ample distraction to Voldemort and his Death Eaters, allowing Harry to escape with Cedric's body by grabbing the Portkey.
Upon his return, Harry tells Dumbledore that Voldemort has returned and is responsible for Cedric's death. Moody takes a devastated Harry back to his room to interrogate him about Lord Voldemort, where he inadvertently blows his cover when he asks Harry whether there were "others" in the graveyard, despite Harry never saying that he was transported there. Exposed, Moody reveals that he was the one who put Harry's name in the Goblet of Fire, and that he had been guiding and manipulating Harry throughout the tournament to ensure that he would win, so Voldemort would take Harry's blood to return. Moody then tries to kill Harry, only for Harry to be saved by Dumbledore, Severus Snape, and Minerva McGonagall. The teachers force Moody to drink Veritaserum, a truth telling potion where it is revealed that he isn't Moody, and that the real Moody is imprisoned in a magical trunk. The false Moody's Polyjuice Potion wears off and he is revealed as Barty Crouch Jr., working for Voldemort. Crouch Jr. is sent back to Azkaban, from which he had escaped.
In the morning, Dumbledore reveals to the students that Voldemort killed Cedric, although the Ministry of Magic is against this. Later, Dumbledore visits Harry in his dormitory, and apologizes to him for the dangers he had to go through. Harry reveals that he saw his parents in the graveyard; Dumbledore names this effect as "Priori Incantatem". Dumbledore acknowledges that even though Harry's parents appeared through Voldemort's wand, no spell can awaken the dead. Dumbledore reminds Harry that he is not alone. Soon after, Hogwarts, Durmstrang and Beauxbatons bid farewell to each other.

Question: How did Harry escape?
Answer: The Portkey.