Here’s a short, non-authoritative, un-fact-checked summary of how deductions work:
You can deduct the cost of your business on Schedule C. You get a fixed amount that you can deduct immediately (I forget what it is these days, but back in the 90s it was $10,000), but outside of that, durable goods have to be deducted over the lifetime of that good (so, for example, if you spent $1000 on a computer for business use, you would be able to deduct $333.33 a year over the next three years, assuming a 3-year lifespan and straight-line deduction. But most self-employed peoples’ expenses will fall within that single deduction limit.
But the cost of goods for sale can only be deducted when they’re actually sold or otherwise disposed of. So, if you spend $1000 to print 200 books and ship them to Amazon and you sell 5 of them, you can only deduct $25 and not the full $1000. But when you decide that the other 195 books are never going to sell and you dump them in the recycling bin, you can then deduct the remaining $975. This is why publishers will “remainder” books that haven’t sold, shipping them off to resellers who will sell them for a fraction of the cover price (you’ll note that books sold in this fashion are generally “defaced” in some way: clipping a corner of the cover or marking the edge of the pages with a marker or some such to prevent them from being sold as new). This allows the publisher to deduct that production cost of the remainder of the book.
Generally all the costs of producing the good for sale will be part of this accounting method, so, for example, if you pay $200 for a cover image, you have to spread that deduction across the sale of all the copies (although generally, you don’t need to spread that past the initial print run if you do a second printing with the same cover image, although your agreement with the artist might call for a second payment in that instance). Accounting for POD and fixed up-front production costs is beyond my ken and I would suggest consulting with a good accountant or tax specialist about that.