The ending resolves the con in three moves: Whitaker dies, Koskov goes home to face punishment, and Pushkin is cleared of the false accusation. The film ends with Kara's Vienna concert and her reunion with Bond.
The structure is a loop, in my reading. The film opens with a training exercise on the Rock of Gibraltar, where a killer murders a fellow 00 agent and Bond chases him down, and it closes on a performance instead of a chase. In between, Bond's decision in Bratislava to wound Kara's rifle rather than Kara is what keeps the finale human-sized. He sees a cellist and not a professional, and he spares her. Koskov then uses her, which makes Kara the one person deceived without being guilty, and her drugging of Bond in Vienna is the price of that deception.
The final act is the strongest part of the film, in my view, because every thread was seeded earlier. Bond is sent to Tangier to eliminate Pushkin and instead finds that the defection was staged. That is the hinge: the order to kill Pushkin was the whole purpose of the con, and Pushkin being cleared at the end is its direct reversal. There is production context behind Pushkin, too. According to Wikipedia, Walter Gotell was too ill to play a major role, so John Rhys-Davies was cast as Pushkin, and Gotell still appears as General Anatol Gogol. The Soviet side of the story therefore carries two generals who turn out to be on the side of the truth, set against Koskov, the general who lies.
The Afghanistan stretch widens the con from a political trick into a money scheme. After Kara's doping of Bond, he is flown to a Soviet air base, and the two of them break out with the help of the mujahideen leader Kamran Shah. The desert scenes were shot around Ouarzazate in Morocco. Only after the breakout do they learn that Koskov and Whitaker are spending Soviet money on opium, which pays for their own weapons deals. That reveal explains why Koskov needed Pushkin dead and the West alarmed: the staged KGB threat was cover for a private business.
The cargo plane fight with Necros is the mechanical centerpiece. Bond sabotages the plane carrying the opium, then fights Necros while hanging from it, and Necros falls to his death. That fight is the film's clearest set piece, since it ends the henchman and the smuggling run in one sequence. Necros had also killed the MI6 contact Saunders in Vienna, so his fall settles that account as well.
That being said, the true payoff is quieter: Kara's concert and the reunion, rather than an explosion. Whitaker's death at his home in Tangier, a location the film uses twice, first as the place where Bond learns the defection was staged and last as the place where the scheme ends, closes the plot, but the film chooses Vienna, where Kara plays, for its last image. As the 15th film in the official EON series, it puts a musician's return at the end where a villain's defeat could have been. The next film in the series is Licence to Kill.