I was approached by Packt a few years ago, to write a book in a fairly niche topic (http://amzn.to/29LR9Ly). Their reputation is not the most stellar, but I put a lot of work into making a high-quality book with source code on GitHub and live examples running on Heroku. So I "beat the odds", I guess... earning several times the (small) advance, and getting some positive reviews on Amazon and Goodreads. The money doesn't justify the time that I put in, but it's tremendous resume fodder and played a large role in taking my career to the next level with my next job change.
However, my biggest regret is that I signed a clause giving Packt the right of first refusal on my next two books. Realistically speaking, I doubt I'll ever get around to writing another technical book again. If I do, I'll probably pitch it to Packt and then self-publish if they don't want it. But it sucks being locked in like that.
Truth be told, if I had known then what I know now then I probably would have just self-published in the first place. There's no real money in book authoring no matter which route you take. Publishers don't really promote books, and you're really on your own anyway for author support during the writing process. I doubt that most employers looking at my resume would care whether the publisher was Packt or Leanpub, so I probably would have gone the latter route just for the freedom.
Of course, if one of your publisher options is O'Reilly, then maybe that's another discussion.
Get dozens of book recommendations delivered straight to your inbox every Thursday.