In Avengers: Infinity War, Thanos managed to assemble all the gems and killed half of the lives in the universe by a simple snap of his fingers. Spider-Man, Black Panther, and most of the Guardians of the Galaxy all crumbled to dust. Thanos claims that his extermination is random, but why did these Avengers die, and others survive? Avengers: Endgame revealed the real reason.
In Avengers: Infinity War, using the Time Stone, Doctor Strange sees only one future in which the Avengers manage to defeat Thanos, among 14,000,605 possible futures. When he gives Thanos the Stone in return for Tony's life, saying, "It's the only way," it's safe to assume that this future hinges on Iron Man. As it turns out Tony has to live because he is the only man who can wield the Infinity Gauntlet in order to win the war in Avengers: Endgame.
In Avengers: Infinity War, one of the most fondly remembered scenes is where Captain America stands up to Thanos, an omnipotent wearing the Gauntlet, who has already defeated the other heroes easily. Cap knows he can't win, but he stands against Thanos anyway, because it's the right thing to do. That sort of action is totally in character for Steve Rogers, and a similar moment happens in Avengers: Endgame which is just as touching and inspiring.
In Avengers: Infinity War, Asgard is destroyed, and Loki, Heimdall, and many other Asgardians are killed. After Thanos' snap of his fingers, half of the Asgardian refugees on a ship disappear, too. Those make Thor one of the last Asgardians in the universe, and certainly the last surviving Asgardian royalty. The surviving Asgardians need a leader and protector, and who better to fill that role than Thor?
Remember, Bruce Banner never turned into the Hulk in Infinity War's final battle. That's because Hulk only appears at the exact moment when his strength is most needed. The fact that this moment doesn’t come in that final battle means it has to come in the sequel, Avengers: Endgame. Besides, Banner's story is only half told, and he has to be alive to tell it. Not to mention that the return of the Hulk is one of the most exciting moments in Avengers: Endgame.
Natasha Romanoff once worked for the KGB, and then for SHIELD. As she put it in Avengers, she's got red in her ledger, meaning she owes the world a debt for the evil things she's done. So Black Widow has to survive the Infinity War in order to complete her redemption. And she did it in Avengers: Endgame by sacrificing her life in return for the Soul Stone. Still, much of her backstory remains a mystery, and fans are waiting for a Black Widow solo movie to clear it all up.
First showing up in Iron Man, James Rhodes is an early MCU hero. The reason for him surviving the Infinity War is that Avengers: Endgame needs War Machine. As the only two government agents in the Avengers, Captain America and Black Widow are now fugitives. The post-credits scene reveals that Nick Fury and Maria Hill die from Thanos' finger snap. War Machine, the most military-aligned hero in the Avengers has to live to communicate directly with governments in Avengers: Endgame.
With the rest of the Guardians of the Galaxy gone, Rocket survives Thanos' finger snap because he is one of the best space pilots around. In Avengers: Endgame, the Avengers, including Black Widow, Captain America, and Hawkeye, go to outer space to find the Soul Stone. They need a spaceship pilot, something that's in short supply on present-day Earth. Fortunately, Rocket is there.
Nebula already wanted to kill her adopted father Thanos, before Infinity War. When Thanos murdered her sister Gamora and wiped out half the universe, Nebula survived. So, what's she going to do? Avengers: Endgame showed us that Nebula was the antihero, who has an important role in stories like this, particularly when he or she has a similar but ultimately divergent goal from the main protagonists.
Sources have always had it that Chris Evans and Robert Downey Jr. will probably have reached the end of their contracts with Marvel after Avengers: Endgame. And it was proven correct when Iron Man sacrificed himself to set the universe right and Captain America chose to become an old man. They won’t return, so they have to survive the Infinity War to be the big heroes of Endgame, which gives them a worthy sendoff.
The MCU officially started with Iron Man, but 2012's Avengers was really the movie that set the franchise on the long road to Infinity War. To remind viewers of that movie, Avengers: Endgame has to end in a place similar to where it began. That's why Captain America, Iron Man, Thor, Hulk, Black Widow, and Hawkeye all survive Thanos' finger snap. The Endgame is a story that's not just about the Avengers, but about the original Avengers.