Today, you'll only get an advance - or maybe small royalties on low-volume sales and no advance.
If you self-pub, you have to consider the market very carefully. If you look at the Leanpub best-sellers they're mostly senior-level niche performance/career dev topics in mainstream corporate languages - like specific performance tweaks in Java.
The bigpubs usually do broad-brush topics like "How to Visual Studio". They're aimed more at beginners and side-movers. They have the marketing links to sell into the big physical bookstores, but for tech that market is smaller than you might expect, so they're unlikely to make anyone rich.
But... it's worth considering all of this is just another example of product/market fit. You get the best results from growing a customer base and giving them what they really want, just as you do for any other business, but with some added complications around product creation and distribution.
You might want to write a fun book about something creative and unusual in tech, but even with a following it's unlikely to sell many copies.
With selfpub you have some control over the big picture. Bigpubs just do what they do. Upfront money and your name on real shelves in a real bookstore may seem sweet, but there are huge costs to authors down the line, and mostly they're not a good deal now.
One major reason is that I am more likely to finish it and get it done than if I rely on it myself.
Another reason is that I want to be known for one niche, this will help and if that works out then I could likely self-publish and keep more of the profit.
It is slightly more nuanced than I want as much cash as possible for this thing.
On the other hand, I've had other periods when it would have been difficult.
The other thing with publishers is that you're now tied into publishing industry economics. So you can't typically write, say, 100 page book even if that's what you think is the best match for you and the subject. (This is probably the thing that would be most likely to keep me from using a publisher the next time.)
I had no problem accepting just 10% of my book sales - without going through a traditional publisher, it would have been impossible for me to get my book carried by physical book stores. Of course, this was 10 years ago, when physical book stores were more common; this may not be such a consideration today.