Some writers do one or the other. Some teeter in the middle ground, saying they outline and know where the story is going, but sometimes characters take over and do things they (the writers) didn't expect.
Best-selling author, Steve Berry, to my way of thinking, is one of those middle ground authors. In a Pittsburgh Tribune-Review article, he says,
"If you outline it all out, it becomes mechanical. It's like watching the same TV show over and over. You already know what's going to happen. It ain't fun."
But, on the other hand, he doesn't just let characters run willy-nilly over the plot. He's ready for contingencies.
"You've got to be prepared to write yourself out....When I'm writing a book, I know everything about that story."
Before he sits down to write, he researches, he prepares for whatever might happen.
So, although he doesn't outline before starting to write, he also doesn't let himself be totally surprised, despite what he said. He has done enough research that no matter what his characters do or where the story turns, he's ready to work his way to the end.