United States Naval Aviator LT Pete "Maverick" Mitchell and his Radar Intercept Officer LTJG Nick "Goose" Bradshaw fly the F-14A Tomcat aboard USS Enterprise (CVN-65). They, with Maverick's wingman "Cougar" and his RIO "Merlin", intercept fictional Mikoyan-Gurevich MiG-28s over the Indian Ocean. During the engagement, Maverick flies his Tomcat parallel to one of the MiGs and inverts his craft in order to give the other pilot the finger – a feat that adds to his already wild reputation. Cougar is almost taken out by one of the hostile aircraft, however, and afterwards is too shaken to land despite being low on fuel. In defiance of orders, Maverick aborts his landing and escorts Cougar back to the carrier being low on fuel. Cougar gives up his wings, citing his newborn child that he has never seen. Despite his dislike for Maverick's recklessness, CAG "Stinger" sends him and Goose—now his top crew—to attend the Top Gun school at NAS Miramar.
Maverick flies recklessly in part to compensate for his father Duke Mitchell, a Naval Aviator with VF-51 aboard the USS Oriskany (CV-34) during the Vietnam War. The elder Mitchell died when his F-4 Phantom II was shot down in an incident Maverick refuses to believe was his fault. Goose is cautious and devoted to his wife Carol and child. The two officers are nonetheless close friends and effective partners. At a bar the day before Top Gun starts, Maverick, assisted by Goose, unsuccessfully approaches a woman. He learns the next day that she is Charlotte "Charlie" Blackwood, an astrophysicist and civilian Top Gun instructor. Upon learning that Maverick is the pilot who flipped off a MiG-28 pilot (and as a result disproved her data suggesting the MiG-28 was limited in performing a "negative-G pushover" due to a "problem with its inverted flight tanks"), she is instantly more interested in him.
Maverick's reckless flying both annoys and impresses LCDR Rick "Jester" Heatherly and other instructors. He defeats Jester in combat but breaks two rules of engagement in the process; becomes a rival to top student LT Tom "Iceman" Kazanski, who considers Maverick's methods "dangerous"; and continues to pursue Charlie. During class she analyzes Maverick's engagement with Jester's aircraft, calling it "an example of what not to do". Later, Charlie admits to him that she admires his tactics but criticized them to hide her feelings for him from the others, and they begin a romantic relationship.
During a training sortie Maverick abandons his wingman "Hollywood" to chase chief instructor CDR Mike "Viper" Metcalf. Maverick matches the older pilot move for move, but Viper maneuvers Maverick into a position from which his wingman Jester—who has already defeated Hollywood—can shoot down Maverick from behind, demonstrating the value of teamwork over individual ability.
Near the end of the training program, Maverick and Iceman both chase Jester; the latter attempts to gain a missile lock on the target. Maverick is close enough to take out Jester with his guns, and pressures Iceman to break off the engagement and clear his shot. Maverick's F-14 flies through the jet wash of Iceman's aircraft and suffers a flameout of both engines, forcing Maverick's aircraft into an unrecoverable flat spin. Maverick and Goose eject, but the force of the ejection slams Goose's head into the jettisoned aircraft canopy, killing him instantly.
Although the board of inquiry clears Maverick of responsibility for Goose's death, he feels guilty and loses his aggressiveness when flying. Charlie and others attempt to console him, but Maverick considers retiring. Unsure of his future, he seeks Viper's advice. Viper reveals that he served with Maverick's father in VF-51, and tells him classified details that prove Duke Mitchell died heroically. He informs Maverick that he can graduate from Top Gun if he can regain his self-confidence. Maverick chooses to graduate, but Iceman wins the award for top pilot.
During the graduation party Iceman, Hollywood, and Maverick are ordered to immediately return to Enterprise to deal with a "crisis situation", providing air support for the rescue of a stricken communications ship that has drifted into hostile waters. Maverick and Merlin are assigned to one of two F-14s as back-up for those flown by Iceman and Hollywood, despite Iceman's reservations over Maverick's state of mind. The subsequent hostile engagement with six MiGs sees Hollywood shot down; Maverick is scrambled alone due to catapult failure and nearly retreats after encountering circumstances similar to those that caused Goose's death. Upon finally rejoining Iceman they shoot down four MiGs and force the others to flee, and return triumphantly to Enterprise. Offered any assignment he chooses, Maverick decides to return to Top Gun as an instructor.
At a bar at Miramar, Maverick and Charlie reunite.

Question: What does Viper set Maverick up for during training?
Answer: His wingman can shoot him down from behind.
Alternative answer: He gets him to leave his wingman.