Do you have to pay to publish a book?
You don't have to pay to publish a book. If a publisher wants to publish it, they will pay you or probably just ask for a percentage of the profit. If they don't want to publish it you will be paying them to publish.
You can self-publish via Amazon Kindle at no cost. They take (if I recall correctly) 30% of the profits.