How much to authors make per book?

I think (correct me if I’m wrong, those of you with knowledge of the book biz) that by the time a book winds up at the Dollar Tree, the publisher has given up on it, and the author isn’t getting any money from the sale of that particular copy (beyond the advance they got when they first sold the book to the publisher). The best-case scenario for them is that you like the book so much, you go on to buy more of the author’s books at non-Dollar Tree prices.

What I wonder about is e-books (and, I guess, electronically distributed audiobooks): sometimes Kindle editions of books will temporarily go on sale for way below their regular price. If I buy an e-book when it’s marked down to $1.99, is the author getting the same amount as if I had bought it for the regular price? (Of course, I might have bought it only because it was marked down to $1.99.)

I assume that the writer was paid when an original store bought the books from the publisher, then couldn’t sell them and sold them at a loss per copy to Dollar Tree (but not necessarily a net loss for the whole stock they originally bought, or course) and the author doesn’t get a penny.

Those will be remaindered books, ones the publisher is getting rid of at a loss. While royalties are usually paid on the official list price, remaindered books will be different. From here:

In my case, my contract specifies that I still get 5% on copies that are not sold “according to the normal discount schedule,” which I believe would cover remaindered books, but at the remaindered rather than at the list price. In the event, the Panama edition wasn’t selling very well locally because the publishers couldn’t find a good distributor. They offered the remaining copies to me for slightly below cost. Now I distribute them in Panama and make 10-15 times a copy compared to what I was getting in royalties. On the other hand, the US edition is selling well and is on its second printing.