User blog comment:Wil Skywalker/Do Luke and Leia ever meet Padme as a ghost?/@comment-5719666-20160223034039/@comment-26275684-20160224042710

In Legends, the way becoming a force spirit is discovered was never shown. The only thing known about it is the fact Qui-Gon Jinn is the one who rediscovered them.

However  force ghosts appeared even before the Old Republic Era.

Some Sith Lords were able to discover similar techniques, but it wasn't as simple as the Jedi way. Occasionally, the spirits of sith lords would be bound to certain locations, objects, and people. In certain interpretations, the Sith's afterlife was way different from the Jedi's. To keep it simple, Jedi go to heaven, Sith go to hell.

In the new EU, not much is said about the force spirit stuff. It can be assumed only Jedi are the only ones who know about becoming a force spirit. In fact, Sith might not be able to use the abilty at all.