The first question everyone wants to know is how much money they will make after writing a book. Publishers generally pay 10%-15% of Net as a royalty. Remember that this is NET, which means after deducting the bookstores fee for selling the book. For example, if your book retails for $50 then a bookstore will get $25 for selling the book. This leaves $25. The publisher calculates your royalty based on this $25. So if you have a 10% royalty then you will get $2.50 for each book. But this only accounts for sales in the U.S. International book sales are heavily discounted because they have a no-return policy (nobody wants to pay international shipping charges twice). So your royalty on international sales could be 1/3 of the original royalty since the books are practically given away. It has been my experience that your true royalty is a little more than half of what the contract says when you average in the effect of international sales. So now you are looking at royalty of around $1.25 for a $50 book.
Here's an example that might put things in perspective regarding the book royalties from a publisher. Amazon.com has an Associates program where you can list a book for sale on your website and put a link to Amazon on it. If someone clicks on the link from your website and buys that book from Amazon, you get a commission for selling the book. Now here's the interesting part: the commision Amazon pays is as much as you will make from the publisher when they sell a copy of your book. Think about this and see where the logic breaks down. For Amazon, all you did was put a simple link on your website for a book and you get the same commission that a publisher pays you after you have worked for six months slaving over the keyboard, getting no sleep, and ignoring your friends. Something just doesn't seem right with this picture. The funny part is that if someone buys your book via a link on your website, you just doubled your royalty! :-)
If your book does well then you might sell 5,000 copies (which just covers your advance of $5,000). Most books don't do very well so you might not even sell that many copies. The computer market is very competitive and unless you are a well known author, its tough to get your books sold. Okay, enough of that, back to self-publishing.