In my Russian History class we just discussed Rasputin and how he came to be so popular with the Romanov court. When he told us that Rasputin was able to gain the Tsarina's trust by healing Alexei, it came with the caveat that he didn't know how, and that most likely it just lucky timing or knew how to induce clotting in hemophiliac blood, possibly using herbalist techniques. That he attributed his powers to divine intervention through prayer would have appealed to the Romanovs. The gist of what we got from him, and mind you he's a college professor and not just reading out of a book, is that what Rasputin did remained the secret of Rasputin himself to his grave.
I looked into treating hemophilia and found this article (PDF file) and it says that when Rasputin magically healed the Tsarevich by telegram and told the family to not let the doctors not mess with the boy and have him rest, he was actually advising sound medical advice. The article says that Rest, Ice (and/or Immobilization), Compression and Elevation are all home remedies for non serious bleeds. This could account for that "miraculous" healing. This implies that Rasputin might have known something of hemophilia.
So it could have been luck or just knowledge from an unknown source allowing him to disguise medical treatment. Either way, it really appears that my teacher's assertion that no one truly knows appears to be the consensus among historians. Some have tried to figure out how, offering up things like the use of aspirin (which is medically ignorant), hypnosis, and as I mentioned above herbs and other folk treatments with no "evidence" that any of them (besides the fact that aspirin causes blood to thin) were his treatment.
I've often wondered this as well. The only answer I can think of is blood transfusion - a known treatment since 1840.
I wonder if Rasputin's and Alexi's blood types are known, and if they are the same/compatible.