Doyle’s ending is effective for two reasons. The first is that clues are given to guide us to the conclusion. The second is that he constructs the ending in such a way that an alternate ending is plausible. The first clue frames the whole narrative an comprises the two opening lines: "She was a writing medium. This is what she wrote."
If you know what a medium is, then you know that the speaker--a narrator who is different from the first-person narrator who speaks throughout the rest of the story--is introducing a tale of spiritualism--a narrative account told by a spirit. If you don't know what a medium is, or don't connect it with a "writing medium," then you are kept guessing right till the end.
Another clue is the sudden, unexpected appearance of the narrator's favorite college friend with a peaceful smile. There is even an embedded clue within the introduction of this new character because the narrator says that he was willing to take things as he found them, which confirms the unusual nature of Stanley's visit:
I was surprised to see him , but I was like a man in a dream, giddy and shaken and quite prepared to take things as I found them without questioning them.
These clues combine with the details about the master's location after the wreck. Doyle does something a little unusual and throws the master's spiritual body away from his physical body. This allows for the introduction of Stanley while both are surrounded by peace and calm. This twist to the usual ghost story allows us the opportunity of anticipating an alternate ending in which the narrator survives the crash--that is it's possible until we hear about the "hushed" voices.