How does Luke do this towards the end of the "Last Jedi"? (Some viewers are calling it a "parlor trick" online, and I think it's an apt expression.)
We see Luke coming to the last Resistance holdout in Crait, talking to Leia, putting the gold charms from the Falcon in her hand, and then going out to face the First Order alone. He survives a massive barrage of firepower, and then faces Kylo Ren face to face, deftly avoiding Kylo's strikes. While he takes on Kylo Ren and the First Order, the Resistance is able to escape.
But at the end of this, we see that:
It's a projection. The real Luke is still on Ahch-To, and he's projecting a "hologram" of himself across the universe.
And after it disappears, we see:
The real Luke coming out of meditation, sweaty and panting on Ahch-To (from the effort in projecting his hologram across the universe, I'm guessing), and falling off his levitation and meditation rock in pain.
He later wakes up, sees the two suns (similar to his first introduction scene over 30 years ago in "A New Hope") and then literally just disappears (like Yoda did at his death in "Return of the Jedi".)
How did he do this? And did he do it this way (as opposed to facing the First Order and Kylo Ren directly) so that he could inspire hope among a new generation of Resistance fighters and Jedi? Towards the very end of the movie, we see:
On Canto Bight, a bunch of kids are telling each other stories of how the amazing Jedi Master Luke Skywalker took on and survived the firepower of an entire army of the First Order (while allowing the Resistance to escape.) The story inspires the kids, and the film ends with one of the kids stepping outside the room, using the Force to move a broom into his hand, looking out into space and seeing a spaceship speed across the stars, eyes bright with hope.