While many programs, including Libre Office, now export directly to ePub format, the best conversion tool out there is Calibre. It runs on Windows, Mac, and Linux, and it’s free. It can convert your Word document or PDF to ePub, mobi and Kindle formats, and it gives you full control over the output.
This section is still in progress.
If you don’t want to convert to e-book formats on your own, note that both KDP and Ingram will do the conversion for you if you upload your book in Microsoft Word format, though you’ll wind up with less control over the output.