Most of us think of receiving royalties (money) for books we write, and that is the usual method. We call the other method a flat fee.
It's probably obvious but the second term means the writer receives a specific amount of money for writing the book and a publisher makes that clear in the contract. For example, if the writer received $30,000 and the book sells a million copies, she still doesn't earn more. That's the risk. Or the book may have sold only 2,500 copies and the writer comes out ahead.
Flat-fee contracts are easier for publishers because they don't have to figure out royalty payments. Sometimes it's to a writer's advantage, but usually not. I did one deal where I received a flat fee and something like 3 percent royalty after the book had sold 100,000. The book was about 20,000 short of that goal, so I received no extra money.
For me, editorial rights are as important as the money issue. Generally, when a writer receives a flat fee, that person has no editor input. I don't like my name on books where copyeditors can change things I've written without consulting me. The publisher may invite the writer into the editing process, but that's not a guarantee. Of the many flat-fee arrangements I did early in my career, only twice was I invited to participate.
Most publishers have a good idea how many copies they can expect to sell; flat-fee arrangements are usually a disadvantage to the writer.