Hello... this is a topic I'm interested in, because I'd like to write one day. Anyway, I thought you might find these resources useful:
1. Nathan Barry has written extensively about his success with self-publishing. Essentially, his method (I'm simplifying here) is to 1. position yourself as an expert in your field via blogging, then 2. directly market to your audience via email using a 3. tiered pricing model (i.e., multiple packages at increasing price-points). He wrote a book about his methodology entitled "Authority."
Authority:
http://nathanbarry.com/authority
Nathan Barry’s Lessons Learned Selling $355,759 on Gumroad:
http://blog.gumroad.com/post/73421524134/nathan-barrys-lesso...
2. Bob Nystrom has written about his experience writing and marketing "Game Programming Patterns."
http://journal.stuffwithstuff.com/2014/04/22/zero-to-95688-h...
http://journal.stuffwithstuff.com/2014/11/20/how-my-book-lau...
A comment he wrote regarding publishing:
https://news.ycombinator.com/item?id=13878280
3. Advice and insight on the topic of traditional publishing from Patrick McKenzie:
https://news.ycombinator.com/item?id=12118914
4. Thread entitled "Ask HN: Has anyone here self-published a book? Any advice?"
https://news.ycombinator.com/item?id=6052075
5. Self-publishing success comment involving multiple pricing tiers:
https://news.ycombinator.com/item?id=13878266
6. Self-publishing success story entitled "How I Made $70k Self-Publishing a Book about Ruby on Rails."
https://news.ycombinator.com/item?id=13876514
All the best!