Most of it was pure imagination. Some of it was a love of Poe. Some of it was the Babalonian mythos.
If you want to hear that there really was a Necronomicon, and Lovecraft read it, you'll be disappointed. If you want to believe that he channelled alien truths of elder horrors, then again...