And yes, writers have to sell a lot of books to make a living. I can imagine a lot of fairly well known writers probably make comparatively little compared to say, a software developer.
It's no co-incidence that you'll often find writers penning newspaper columns or appearing as talking heads on TV shows and the like - it's regular money which supplements the irregular and not massive income they get from writing.
Full breakdown here but the publisher is basically getting about 50% of the list price so your $30 is already down to $15 by the time it gets there:
http://www.askdavetaylor.com/how_do_the_costs_of_publishing_...
He's probably right that tech books are broken but I think it's important to distinguish between technical books and other books which don't share the same model.
Edit: That might not be the publishers fault though.. Anyone know how the $29.54 breaks down? How much does amazone take for example?