The trio arrive at a remote planet where Luke has been hiding in a throne room of sorts. The Jedi Master finally appears and reveals that Rey is his daughter, and she and Finn are destined to be trained by him. But the group relay Maz’s message and tell Luke what has happened to his good friend Han Solo.
This is no surprise to Luke. As a matter of fact, he is prepared for what must be done — and now’s the perfect time. (Luke can see what Snoke is up to, and while the Dark Sider is tied up laying waste to Kylo, Luke gets an opportunity to use his Force powers elsewhere instead of countering Snoke’s psychic attacks.) Luke presides over the body of Solo and uses the Force to recreate life and bring the smuggler back from the beyond. The poetry at play here is quite beautiful as Kylo indirectly saves his dad by attacking Snoke, which gives Luke the opening he needs to resuscitate Solo.
As for how this is possible… Snoke is actually Darth Plagueis, the only Sith to have discovered the secret to cheating death. He fooled his apprentice, Darth Sidious, into believing he had died. Once Plagueis engaged in a psychic Force battle with Luke, both warriors inadvertently become open books to the other in a sense. Over the years, Luke has been able to glean many abilities some might consider unnatural from the mind of Snoke. None more valuable than the ability to bring back the dead.
Luke has become fully trained in both sides of the Force by locking minds with Plagueis in order to counter each other’s moves and guarantee a state of paralysis. This is something Luke knew he would have to do, especially after seeing how he needed to tap into the Dark Side in order to overpower his father in Return of the Jedi. This duality of the Force is high risk, high reward, but Skywalker has managed to balance Light and Dark Sides and become the most powerful grey Jedi in history.
So those rumors about Han Solo dying… they’re true… from a certain point of view.