Tooling is mostly unimportant. Writing the actual book should consume much more of your time. Unless you have very specific requirements around the output
(e.g. one of my books has animations so I wanted something that made them easy to embed: https://www.creativescala.org/creative-scala/cycles/interpol...) spending time on tooling is yak shaving. Choose something using a tool chain you can live with and move on.
For selling books, try to do most of your sales via your own site. Gumroad is a good partner for selling PDFs. Lulu is pretty good for printed books. Amazon is a necessary evil due to their reach, but they will charge a much higher fee than doing it yourself and they are evil. If you don't self publish your royalty rate will be such that except for the few best selling books you won't make any significant money. It can be worth going with an established publisher if you want the prestige (and perhaps you can leverage that into $s) but in most cases I think self publishing is a better option.
Let me again emphasize writing the actual book is much more important than messing around with tools.
In addition to concentrating on the writing, just keep the content simple with minimal markup if possible so that it's easy to rejig later if needs be.
People rag on Amazon, but as a book buyer it's nice to have all your books in one place on a platform that's likely to be around next year, rather than random PDF's that end up who knows where. It's also nice that the book is subjected to reviews. Those can be capricious and unfair at times, but if there are enough, you get a better sense of the book than "Buy it! Trust me!".
This 100%. Make sure you spend no more than 20% of you time in tools. For most people 10% is better,but since you are doing math plain text isn't good and so I give you a little more time. But always focus on content first.
For selling books, try to do most of your sales via your own site. Gumroad is a good partner for selling PDFs. Lulu is pretty good for printed books. Amazon is a necessary evil due to their reach, but they will charge a much higher fee than doing it yourself and they are evil. If you don't self publish your royalty rate will be such that except for the few best selling books you won't make any significant money. It can be worth going with an established publisher if you want the prestige (and perhaps you can leverage that into $s) but in most cases I think self publishing is a better option.
Let me again emphasize writing the actual book is much more important than messing around with tools.