In cannon there isn’t yet an explanation as to how Anakin turned into a force ghost, atleast I think.
I believe before EU became legends, here was some novelization that said Obi-Wan told Vader how to do it right before Vader had died. In his head similar to how Obi-Wan contacted Luke.
I mainly remember that in the epilogue to the 2007 novelization, The Rise and Fall of Darth Vader by Ryder Windham.