So there's no specific answer to this question. But here's how the money usually works. When you sell your book, you're really selling the publisher the right to print it. In exchange for the right to publish, the publisher agrees to pay you a percentage of the purchase price of the book when it is printed and sold, usually about a year from the delivery of the finished book. This percentage is called a royalty, and it varies wildly, even within the same publishing house.
Advances range from a couple of hundred dollars to millions.
Royalties arrive six months to a year after the book has been published, but only part are paid out to you. After the advance has been subtracted, the publisher keeps a reserve against returns so that if some of your books are returned from the bookstores that ordered them, he won't have overpaid you. If your publisher or agent sells your book to a foreign country, you get more royalties or a flat fee from that sale. As for how long it takes me to write one, that depends. The fastest I've ever done a book was six months for a short novel, but that was one of those rare birds where everything came together and there were no massive problems to work out.