An advance is, in longer terms, an advance payment against the future royalties that the author will earn once their book is published. Typically, an author will earn 10-12% of the profit the publisher makes from the book sales.
PRH have sold a lot of copies of Spare, which is good for them, and good for Harry. The book’s RRP in the UK was £28. That’s obviously not the price that the retailers paid PRH to buy it though. Given some of the larger retailers immediately cut its price to hopefully sell more copies, the wholesale price must have been around £10-12, at a guess (the retailers are unlikely to sell below their purchase price on a new publication).
So, doing a very straightforward calculation on the assumption that all the copies are hardback (which we know they are not), selling 3 million copies at £12 per book = £36m to PRH. Being generous to Harry, and assessing his royalties at the higher end of the range (12%) that would earn him £4.32m. A great amount - but not remotely close to the £20m that PRH has allegedly paid him. That doesn’t really matter though - in a deal like this I would bet his advance was guaranteed - i.e. he wont have to pay it back.
That number is a simplistic calculation, based on a lot of assumptions. Firstly, royalties are paid out of the publisher’s profits, not gross sales revenue. So RPH will have to deduct all the production/ shipping/ translation/ publicity/ ghostwriter etc fees from what they make from the book. Harry’s royalties come out of what is left. So that will likely mean the figure is lower.
On the other hand, the 3m sales also include e-books and the audiobook. They are much cheaper to produce, and although they also sell for a lower price, the publisher makes more money on them. So that will bring the total profit figure up.
Bottom line, it’s impossible to know if Harry would earn his advance back in royalties. Based on the amount he was reported to have been paid, and the amount of books reportedly sold, it looks unlikely. Generally of course publishers think a book will have “legs” - it will continue to sell well over time, and then will also sell well as a paperback. I’m not sure whether that will be true for Spare - it made an almighty splash when first published, but will people be buying in large numbers in a month’s time? This is relevant because once Harry’s spent his advance on the book (which he would have been paid when he was signed up several months ago), he’s unlikely to earn more in future from Spare - it will take him a long time and an awful lot more sales to hit the £20m figure and then be entitled to be paid royalties as they are earned each year. So PRH are currently doing well from the sales, but they are the only ones.