Scott Meyers, author of Effective C++ has put together a guide titled: Advice to Prospective Book Authors.
It has lots of good advice for people considering writing a book. Here are some excerpts from the section on royalties:
You should have some other reason for writing a book than making money from it. A very good reason, I think, is to help establish your credibility as a consultant, or to otherwise use it as a kind of business card. ...authors should never keep track of how much time it takes them to write a book, because if they do, they'll be able to calculate how much they made per hour, and the result will almost certainly be depressing...
In general there are a lot of good tips and guidelines for working with publishers in this article. Some of these points would have been useful for me before writing The ColdFusion MX Developers Cookbook.