I’ve ghostwritten a couple of books and enjoyed doing so. The payment is almost always a fixed rate, paid in installments. The first payment is required to start the work, and the final payment is due when the writer submits the finished product to the author. (The person who hires you is the author—you are the writer).
The number of installments for ghostwriting books is up to you and the author. Two, three, or four are common, but my last book was in ten installments (per the author’s suggestion). Also, try to frontload the installments so that you receive more money in the beginning. That way if things don’t work out, the author changes their mind, or they stop paying, then you have received most of your compensation.
Don’t write on spec or have it contingent on them getting a book deal. Also, avoid a 100 percent revenue share based on books sold.
Though you could negotiate a base fee plus a revenue share unless the author has a large platform and can sell books, assume there will never be any significant revenue for them to share with you. So make your base fee large enough to make the project worthwhile.
Two related items: When it comes to ghostwriting books, always have a contract that states your fee, the installment amounts and dates, and details of what is and isn’t included. A basic “work-for-hire” agreement should work. (Disclaimer: I am not a lawyer, and this is not legal advice.)
The other item is to be aware that you are selling your words and cannot claim them as your own or reuse them for another purpose. (Though a nice author may share the byline with you or acknowledge you were the writer.)
I hope this helps, and I wish you the best.