The 'traditional' way to get a book published has been for the writer to find an agent (a few months to years), the agent to find a publisher (also years), and the publisher to put the book out (at least a year.) The chances of rejection at any step were, and still are, very high. Examples of well-known books stumbling along this rough road are myriad. The Help was rejected 60 times; Gone with the Wind something like 120. Not long ago--really only a few years-- the only other way to publish was through vanity publishers: you pay a publisher big bucks to print your book and receive a minimum number of copies, usually in the thousands, which you then stored in your basement or garage while you figured out a way to sell them. Non-fiction books, especially today, can become obsolete before they are ever printed.
That has all changed with two technological advances. First ebooks have made it possible to get books in the hands of readers with much less expense and resources. Second, digital printing has produced 'print-on-demand.' It is no longer necessary to print at least 5000 copies in order to get the cost per copy down to something a reader can afford. A single copy of a physical book can be produced with a very small up front cost, which is immediately recouped from the reader who orders the book.
So today, anyone can publish a book and it's happily ever after for every writer and reader, right? Of course not. No good story ends that easily. With self-publishing, the reader does not have the same assurance that the book he is purchasing is well-enough written and edited that someone else besides the writer (such as an agent or a publisher) thinks it's worth the reader's time. The writer bears the full responsibility of seeing that the book is copy edited and formatted to be the best reading experience he or she can make it. Unfortunately, this is not always done.
Because of the lack of consistency in self-published books, reviews from respected sources are very difficult to get. These reviewers are reluctant to touch a self-published book with even the well-known ten-foot-pole. This, too, is changing. Organizations and web sites that vet 'indie' books are appearing and performing this valuable service. Marketing something like a book is difficult enough, and a lack of good reviews increases that difficulty.
So why would anyone bother to write a book and self-publish it? The average self-published book sells fewer than 500 copies. But writers are passionate about their work. It's like singing in the shower. You sing because it's fun and you feel like it, not because of the money and fame.
The reasons people gave yesterday for self-publishing are as wide ranging as the subjects and genres of their books. Time is a big factor. Writers of a certain age want to make sure they see their work in print. Books on topics in fields where information is constantly changing and updating need to be available as quickly as possible. Artistic control is another reason. One writer of a long fantasy novel said publishers wanted him to cut his book in half. He decided he would rather keep it intact and self-publish no matter how that would affect his sales. Royalties are much better with self-publishing. And many books are written for a very limited market--local or family history, for example.
But probably the biggest reason is the opportunity to hold a printed copy of your own efforts in your hot little hands. There is no feeling like it.