Hey Karis. That’s a good question.
Most self-publishers utilize print-on-demand (POD) technology (as do most traditional publishers at this point), so books aren’t actually printed until a customer orders them.
If you’ve produced the book yourself, the two most popular options for self-publishers for POD are Amazon KDP and IngramSpark. These platforms will distribute your book to retailers, and then when a customer orders a book, they’ll same-day print it and ship it. You don’t pay anything for the inventory, you just get paid when the book sells.
There is no (or very little) upfront cost to set up the printing and distribution of the book through these companies.
You can also produce the book (like editing and design) using free tools that they offer, but you’ll get better results if you hire professionals with professional experience, tools, and software to help you. A reasonable ballpark for a complete 5-step book production of a 40-60k YA novel is $2,500-$5,000.
There are companies that will complete the full production and distribution for you, and the cost for that varies widely. Generally, you get what you pay for, but there are also a lot of predatory companies offering these services (like Xulon, AuthorHouse and Christian Faith Publishing, in my opinion), so proceed with caution.
If you want books to use/sell personally (including to give to reviews, sell at events, etc.) you can also order those books at a wholesale cost through either of the platforms that I mentioned above. If you wanted a lot of books, like more than 1,000, you would get a better price by hiring an offset printer directly, of which there are many from which to choose.
Here are a couple of resources that might help:
The Three Publishing Paths explains your publishing options and the process in more details. You can get it for free from The Company: https://writers.company/resources/the-three-publishing-paths-by-brad-pauquette/
The Self-Publishing Handbook outlines the proper 5-step publishing process. You can get it for free from my website, or get it on Amazon: https://bradpauquette.com/downloads/the-self-publishing-handbook/