Disclaimer: I work for a book publisher.
The author takes nearly zero percent of the financial risks. Contracts vary of course but it is typical for an author to receive an advance on signing the contract and on delivering the manuscript. These are advances against the royalty the book is expected to earn but unless there is a breach of contract that advance is not returned to the publisher. The publisher then puts all the money up front to edit, design, print, and distribute the book to retailers. If the book does not sell then the publisher gives the retailer a full refund and eats the whole thing as a loss. E-books are great because they take out the costs associated with printing the books and dealing with returns but they still eat the costs when a book flops ... and most books flop.
So yes, self publishing is a great option for those authors who are willing to invest the time to write a book, the money to hire professional editors and designers, and the risk that they won't make a dime. Oh, and they have to figure out how to market it, convert it into an e-book, and deal with all the sales bullshit. This might be crazy talk but most authors are dedicated people who love to write books. Few desire to spend the time and energy on the business side of things to produce, market, and sell those books.