As writers, we all hope to earn enough from our craft to live. Nothing promotes the completion of a next book as much as income from the last book (and the time needed to write it). Leaving that day job to write full time can be a big, scary step. For those of us not in the graces of a wealthy sugar-momma, the Book Royalties Calculator by Shawntelle Madison is a valuable tool in helping determine how much your royalties might be.
Writers receive an "advance" on royalties from the publisher based on an estimate of what the publisher thinks the book will make. The rule of thumb is that the amount of the advance is close to the number of physical copies they expect to sell of the book--so $10,000 means 10,000 copies. (How this pertains to e-sales is uncertain.) Royalties do not kick in until the publisher first earns back his/her cost of producing the book. Before you start calculating the cost of paper and ink, stop a minute and really consider all the expenses involved in running a publishing house -- after all, that cover didn't paint itself.
A publisher has a great many people servicing his enterprise that are not immediately obvious to the writer typing away in his/her secluded cabin. There are the editors; designers and illustrators, public relations people to promote your book; assistants and secretaries; accountants (checks don't cut themselves); mail costs (both people and packages); the publisher's salary, and don't forget lawyers. Then there are fixed costs like rent; heat and electricity (unless you want your people freezing in January); and, of course, good ole Uncle Sam wants his cut. On top of that there need to be profits that go to the owners or stockholders of a company--the ones who took a financial risk on you by giving you that advance. All these have to be paid out of what the publisher makes on your book.
Also, keep in mind that the publisher does not receive the full cover price of the book. If a hard cover is $24.99 at the store, the publisher likely gets half that, and in many cases less if there's a discount for a huge buyer like Amazon or B&N. (That's why Amazon can sell that book for $16.99--they order a gazillion copies.) That said, you are the writer, the creator of the property, and are entitled not to live below the poverty line. It all comes down to sales. So start calculating.