As an amateur writer I get asked this all the time by people who aren't writers. It's a harmless question, but the assumption is that after the book is finished, it's just a simple matter of handing a manuscript in to the publisher and then seeing it show up gloriously on the bookstore shelf. I think most people also like to imagine themselves one day writing a novel, and then kicking back after the hard work has been done, while everyone else appreciates them. Also, the very drastic difference between actually having a book published by a publisher, and self-publishing it on your own, is completely lost on a lot of people.
I'll try put it all into better perspective with the following discussion.
"Publishing a book."
This is when an established company known as a publisher decides to invest their money into a manuscript you wrote in order to turn it into one of their products. They then own it and pay you fees known as royalties when it sells. If they want to edit and change it, they will. Usually they'll do a reasonably large print run on it, and perhaps advertise it and distribute it through bookstores and so on. Remember that this is an act of business, not primarily a celebration of your artwork. For that business to publish your manuscript, they will first need to assess the likelihood of making a return on their investment, just like any other business decision.
Imagine running a publishing company yourself. You have to pay staff wages, offices and equipment, book printing costs, advertising, tax... all the normal business expenditures. You wouldn't want to publish a book that doesn't sell, otherwise you'd go under pretty quick. There are mountains of manuscripts written by thousands of people, but most of them will in fact not sell. That's why it's better to invest in books that aren't so risky: cookbooks, memoirs of celebrities and successful sportspeople, formulaic romance/erotic novels, re-prints of classics, bibles, and so on. Hollywood is basically the same with movies. Aren't most of the ideas invested in nowadays either remakes or continuations of successful franchises? Movie-makers lose millions when a film flops at the box office, but there are a lot of stereotypical films that they know are going to make money no matter how many times they are re-hashed. It's a similar situation with the book publishing industry.
Yes, some creative and inventive fiction sometimes turns into overnight success. But most of it doesn't. The odds aren't much different to that of winning the lottery. Generally, the type of creative writing that makes it through a publisher is usually designed for a particular genre-loving-demographic, and is written by authors who have built up a bit of credibility by slowly publishing short stories in magazines, and doing the hard yards writing material for b-grade television/radio, etcetra.
"Self-Publishing a book."
This is where you as the author do everything yourself. You not only write the book, but you typeset and format it yourself, edit it, design any cover/art, and so on. That's not to say you might not outsource some of those things, but at the end of the day you are individually responsible for getting everything across the finish line, and that includes funding it yourself. If it doesn't sell, the loss of investment is on you, not an external publishing company. By taking this approach, you retain full control of the project, but miss out on any help provided by a publisher's reputation/advertising and of course their financial investment.
There are local companies that can make a print version of your book. But unless you go with a large run of copies (like 500+), it won't be very cost-efficient at all. And you wouldn't want to print that many books without knowing whether anyone would buy them. On the other hand, there's eBook publishing, which can be done quickly and easily on Amazon and many other sites. It's so easy in fact, that the online market is swamped with titles that are very low quality, and short works are often indistinguishable from long ones. The reviews you will read for self-published e-books are largely written by people within the author's own social network. You could steal your little sister's diary and publish it on Amazon if you wanted to. Hundreds of titles go up every day - it's hard for a serious novel with any decent merit to truly stand out.
Personally I'm more interested in self-publishing, because the primary goal of my writing is not to sell a product but to enjoy the creative process. I love developing stories and characters, and crafting well-formed sentences. I love learning new words and finding appropriate ways to deploy them. Turning a book into a product that someone else can buy is a secondary objective. In fact, my next novel will be digital only, and completely free.