They seek it. If your book doesn't make them want to stay awake another hour, they know the public won't buy it, and they will pass. If you're a huge author, you're not reading this anyhow. You know the process. You live it.
Huge authors get advances for fiction, as well as for non-fiction.
If you're an unknown author on the way to becoming huge, things are a bit different. In general, fiction authors finish their books and then sell them. That's partly because there are far more works of fiction than non-fiction, along with a smaller market. Publishers can probably find all of the fiction works they want, by digging the best out of the slush pile if necessary. Non-fiction authors generally receive advance payments against royalties before the book is written.