Some writers call it their muse. Some may just call it their inspiration. I'm certain there are many ways to desribe what it is inside us that prompts authors to write. I'm also certain that it is entirely different for each of us. So, I can't speak for other authors, but I can tell you what it is for me.
Being a devout Christian, as far as I'm concerned, what it is inside me that enables me to write a story is nothing less than a gift from my Creator. It is the spark he puts in me that provides me the flashes of inspiration that find their way out of my mind and onto my computer screen. Whether the story I'm writing is something dark, or something filled with joy, I still believe that it is God who gave me the ability to put it down into a story of fiction.
As I considered this self analysis, I came to the conclusion, at least for myself, that I am like my Father in Heaven. That is, I want to create worlds. I find great satisfaction in developing a complete world filled with lore and history, people and cultures, and all the trappings that make a world believable and alive. I want to be just like my Father, in that respect. Of course, my worlds are only worlds of imagination. Even so, I find great enjoyment in the process, and then creating stories within it.
This is the approach I used for my Rangers of Laerean series. First, I created the world, then a few characters, and then began telling their stories. Even though these first parts were tedious and took time, I still enjoyed every moment, and the process is far from complete. I'm still creating more and more in the world of Hir. I may never reach a conclusion. Unlike my Father, who finished his work of creation, and it was good.