A deadline is really good for that! Seriously, though, it's such a deeply-ingrained desire. I would write--and I have written--when I had no idea whether any of my stories would be published.
It's so much fun to create characters and see what they do, listen to what they have to say. I love when they surprise me, and I love how seemingly unrelated things come together. I didn't do it on purpose, but there it is in the final draft. An unplanned theme or motif or insight. It's soul-satisfying when that happens.