WARNING: The following feature contains SPOILERS for Supergirl's season 4 finale.
Lex Luthor's shocking death in the Supergirl season 4 finale unexpectedly ties into the upcoming Crisis on Infinite Earths crossover event. Indeed, the shocking revelation at the end of the episode suggests that Lex's death may not be permanent and he will return for the 2019 Arrowverse crossover event this fall.
At the end of "The Quest For Peace", Luthor teleported out of his power armor and emerged in a bunker behind Luthor Manor, located underneath the tree-house where he and his sister Lena had played as children and hid when their father was on one of his drunken rampages. Lex wasn't surprised to find Lena waiting for him, saying that she was the only person ever capable of keeping up with him. Lena did surprise her brother, however, when she drew a small pistol and shot him twice in the chest, saying that the only way the Earth could be safe was for him to die. Lex, in turn, used his dying moments to surprise Lena, revealing to her that Kara Danvers was Supergirl and that she and all of Lena's other friends had been lying to her for years and hiding that fact from her.
The final scene of "The Quest For Peace" sees the Monitor - the cosmic being behind last year's Elseworlds event - materializing inside the bunker, where Lena apparently left Lex's body to rot. The Monitor regards the corpse for a moment before raising his hand, which begins to gather a blue cloud not unlike the breaches which the Monitor has been seen using to travel between worlds. The scene fades to black before we see what happens, but the implication is that the Monitor has need of Lex Luthor - or his body - for some reason.
Lex Luthor played a key role in the original Crisis on Infinite Earths comics - first organizing a number of villains in an effort to take advantage of the chaos, then ultimately organizing them into a force to help the heroes save reality. After all, the Crisis on Infinite Earths event series was about destroying all of reality, and even criminals live in the same reality as heroes. A destroyed reality meant that there was no reason for them to be around.
It's possible that the Arrowverse is going to use Supergirl's Lex Luthor as a replacement for the comics' Alexander Luthor, Jr., who was a hero on his Earth and was instrumental in defeating the Anti-Monitor. Given that Alexander Luthor, Jr. was from Earth-3, an Earth ruled by villains, the Arrowverse may be using Earth-2 (Supergirl's world) as a substitute. Of course, not everything will be recreated exactly from the comics, so Supergirl's Lex Luthor could be an unwilling pawn in saving the multiverse in the coming Crisis.
Only time will tell if the Monitor resurrected Lex Luthor with the intention of turning him into a general for the army he is building or simply needs Lex Luthor's intelligence for some other purpose. Whatever the case, it cannot be denied that when it comes to finding a way to do the impossible and survive, few can match Lex Luthor.