I believe they get paid a certain fee up front, and then royalties from their book sales. It could range from several thousand dollars to several million dollars, depending upon different circumstances (who the author is, if they're known/unknown, what the book is about, if the publisher thinks it will sell in a wide range market, etc.) I'm no expert though.