A simple question. Many common answers, some probably better than others.
To entertain others.
Because I must. The voices in my head won't shut up until I set them loose on a page.
Because I can do better than most of the crap that gets published these days. (Not my reason, but I've seen it.)
Because I love it.
I think for most of us, love comes into play somehow. Some kind of love is involved. Is it the love of the writing process? Is it the love of the finished product? Is it desire for the love of readers?
For some, that last one is a solid NO. "I write for myself, not the reader." I think that's valid, but I only fall partway into that category. When I start drafting a story, the first, most instinctive criterion is to write a book I'd want to read. (This is always a good idea, considering the number of times I'll go through a manuscript with revisions and editing passes.)
But I also write for the reader ... I hope I do, anyway. I try to write books teenage-RC would've liked to read, and I know there are plenty of current teenagers who have just enough in common with RC-of-ages-past to enjoy similar elements.
I try to create characters who resonate. Forgive the physics intrusion, but for resonance to happen, you need two things—the sounding tone (provided by the author) and the resonant object (the reader). It's kind of a cool thing to have someone think you wrote in some brilliant symbolism, but you know it wasn't your conscious intention. That reader brought some of the brilliance by viewing it through their own lens.
(And yeah, I think I just mixed sound and optics metaphors there ... turning off physics-brain now.)
Sometimes we get so bogged down in the hard stuff about writing and publishing that we forget the love—whatever love it was that brought us to this art. We fret over query letters. (Guilty) Rejections deject us. (Guilty) We fear our writing sucks so profoundly that no one can put their finger on why, so we'll never be able to fix whatever's wrong. (Guilty-Squared)
If you find yourself in a place like that, stop and take a breath. Remember why you're putting yourself through all the contortions and seeming torture that it takes. I hope on some level, it's because you love it.
Love takes work. Love brings pain. But love is worth it.