As you can see, there are as many ways to do it as there are authors doing it, and all of them are right. So, here's my method.
For ebooks, I write in LibreOffice I use boilerplate .odt files for front and back matter. I have custom styles in .ott files for chapter narrative, chapter headings, first paragraph chapter, first paragraph scene, and scene break line.
I build the .epub file with Alkinea.
If the .epub file needs tweaking, I use Sigil.
For the print edition, I typeset with InDesign CS2, using a .doc file I've exported from the .odt document file with LibreOffice and an InDesign template file I built for print editions.
GIMP is the graphics editor I use for e-book and print edition covers.
All these steps have learning curves, and they all involve free software.
The one downside to my approach is that once the two editions are formatted, there are two text databases to maintain in case of editorial corrections after publication. That's unavoidable because I have yet to find an editor that does an acceptable job of page typesetting. Others disagree but I am old school.
That's all for fiction. I have similar but different procedures for nonfiction.
Good luck in developing your methods. There are lots of good tips and help available here from authors who have done their own.
My advice is this: Do not pay or otherwise engage someone to do your formatting. They have a way of disappearing later when you want to publish a new edition.