Her reunion with Luke has a loaded message
On Crait, the Resistance is about to lose all hope. They're trapped in a military bunker. Their resources are dwindling. Their people are dying. And just as Leia is about to resign herself to this grim reality, her brother Luke Skywalker appears out of nowhere.
It's a shocking moment, as Luke spent his earlier scenes protesting a triumphant return. But it's so welcome, and fulfills the desire many fans had going into The Last Jedi: to see a Luke and Leia reunion. (It's also a great opportunity to bring back John Williams' "Luke and Leia" theme, a haunting and underrated ode from Return of the Jedi's score.)
Of course, the scene is a bit of a diversion, as Luke isn't physically there: he's Force-projecting himself to Crait from Ahch-To. But it's still undoubtedly Luke, and as we learn by film's end, he knew he was saying goodbye -- though there's no way Mark Hamill could know that the scene also works as a goodbye to Carrie Fisher. His lines -- about how we're never really gone -- are punctuated with the gravitas of her being gone. It's Luke and Leia saying goodbye, it's Mark and Carrie saying goodbye, and it's us processing her death through final union of our childhood heroes.