Marvel Studios began setting up Avengers: Infinity War.
But the MCU is a superhero franchise inspired by comics, which means Loki's death doesn't mean his story is over. The Avengers, vanishing with the Tesseract. This is the version of Loki who will return in his own Disney+ TV series, which promises to chart a very different path for the Trickster God. But it will clearly still be a redemption story all the same, because the Loki trailer showed him looking at footage of the Battle of New York with regret.
Marvel actually began setting this up back in December 2018, when they revealed Loki was mind-controlled in The Avengers. They did this through an update to the official Marvel site, which clarified Loki's role as that film's villain.
"Arriving at the Sanctuary through a wormhole caused by the Bifrost, Loki met the Other, ruler of the ancient race of extraterrestrials the Chitauri, and Thanos. Offering the God of Mischief dominion over his brother’s favorite realm Earth, Thanos requested the Tesseract in return. Gifted with a Scepter that acted as a mind control device, Loki would be able to influence others. Unbeknownst to him, the Scepter was also influencing him, fueling his hatred over his brother Thor and the inhabitants of Earth."
It's a smart retcon, because it explains some of the most puzzling questions about The Avengers. It explains why Thanos gave Loki the Mind Stone in the first place. It was because he knew the Mind Stone would exacerbate the hatred in Loki's heart, ensuring he complied with Thanos' will and unleashed the Chitauri upon Earth. It also explains why Loki looks back at the Battle of New York with regret in the trailer for Loki; he was indeed ashamed at what he had done, perhaps even becoming conscious he had been manipulated by one even more treacherous than himself.
With the benefit of hindsight, this retcon can presumably be seen as Marvel beginning to prepare the way for Loki's return as the star of his own series - not necessarily as a hero, but certainly as a "shades of grey" character rather than an outright villain. This is an arc comic book readers will recognize from Al Ewing's Loki: Agent of Asgard, one of the definitive comic book portrayals of the Trickster God, and it will be exciting to see the MCU embrace this vision of Loki.