Part of the difficulty in producing ebooks is that the various devices used for reading them (computers, "smart" cell phones, dedicated readers, and tablets) use different apps and file formats. There are, for instance, in addition to the Kindle devices that can read ebooks, free Kindle apps you can download for smart phones, tablets, and most computers (OS X/Mac and Windows).
Most of the various conversion methods or formatting methods for ebooks rely on Microsoft Word, and/or HTML. The HTML from Microsoft Word is wretchedly awful, consequently, most formatting guides will tell you to use Save As from the Microsoft Word File menu, and then choose Save As “Web Page (Filtered)”.
There isn't an option to Save As “Web Page (Filtered)” in Microsoft Word for OS X, so OS X users may be frustrated at that point. Some OS X users have discovered that they can use the HTML from Libre Office for OS X, and proceed from that point on. It will partly depend on how complicated your document is.
You can usually use the free Open Source Libre Office instead of Microsoft Word, but the instructions for using Microsoft Word will only apply in very limited ways. You'll essentially want to get to a very vanilla HTML file. Libre Office is free and you can download it for Mac OS X, Windows, and Linux.
Most instructions for producing an ebook of any sort rely on converting a file from one format to another. Be aware that there are often problems with ebook file conversions in terms of formatting. Check your book for errors and problems after you convert it.
Software Tools For Ebook Conversion and Production
The following is a list of software tools that people use to convert HTML or Microsoft .doc files or various kinds of ebooks or other files (ePUB, epub, Kindle, Mobi, etc.) to ebook files. I'm mostly familiar with Mac OS X tools, so I'll also point you to James MacDonald/Uncle Jim's Making Light post about Software for Self-Publishers, which discusses print and multiple ebook file formats. Pay special attention to his comment about his workflow and production method.
Sigil is a free open-source multiple-OS command-line tool for Ebook production. It's gotten increasingly better in terms of features and ease of use.
I'd like to call special attention to this ebook formatting tutorial from Cameron Chapman: Ebook Formatting The Easy Way. It's fairly thorough and straightforward. I'd likely do more hand-tweaking to the final files personally, but this is a decent tutorial and represents a lot of labor by Cameron Chapman.
Mobi Pocket eBook Creator . Download link (Free: Windows 2000/XP with Internet Explorer 5.0 or above but see this note).
Calibre E-Book Management (Not only manages your ebook library on your computer, it can be used to convert from one format to another). Download Calibre (Free; Windows, OS X, Linux, USB keychain/portable). Current versions of Calibre can automatically convert .docx files created by Microsoft Word 2007 and newer. Import the file to Calibre and click convert. The results range from near-perfect to gibberish, depending on the file; see this guide from Calibre about converting directly from MSWord. Also see the various E-Book Creation tutorials.
Adobe's InDesign. (Mac OS X, Windows, and not at all free or simple). This is an industry-standard, powerful, complex, and flexible app that you can use for your print version, .pdf, .epub, and Kindle/Mobi books. You'll need Illustrator and/or Photoshop (or very similar tools) for covers and images. The rest can be done in InDesign—but it's not for the amateur.
Scrivener from Literature and Latte is useful not only for writing your book, it's quite good at exporting epub format books. (Mac and Windows; about $45.00, but watch for sales in Novemeber /NANOWRIMO). Check out the free 30-day trial. This is a really nifty program for any writer, frankly, never mind the ease of making epub ebooks.
Liz Castro wrote the book on creating epub books: ePub Straight to the Point: Creating eBooks for the Apple iPad and other Readers. Castro uses step-by-step project approaches to guide readers producing an ePub file from Microsoft Word or InDesign, with some discussion of epub file structure, HTML and CSS. See also her excellent Website and tutorials on her site Pigs, Gourds, and Wikis.
Nisus Writer Pro from Nisus for OS X has a decent ePub export feature as part of a full-featured multi-lingual word processor (it's $79.00).
Pages from Apple ($20.00 for Mac OS X Lion or later). You can produce your printed book's file and and nicely formatted .PDF and ePub files via Export from Pages by using the free Apple Epub Template. Note: Don't Change the Names of The Styles.
If you're running Apple's OS X Lion/OS X 10.7 or later there's a nifty Automator action to create an ePub ebook from a .txt or .rtf file. Here's some more on using the Automator Text to Epub tool.
ePub Reader is a free Firefox Web browser (Mac OS X or Windows) plug-in to let you read ePub books in your browser. It's a great way to do a quick preview to check how an ePub book will look on the computer screen in terms of basic formatting. ePub Reader creates a "library"—which allows you to look at an "exploded" or un-bundled ePub and see how a book was made, or access the CSS to modify it. Exploding a book via ePub Reader is useful in terms of tweaking an exported ePub ebook or seeing the file structure.
There are also AppleScript based droplets for Mac OS X to zip and unzip ePubs here; scroll down for the current version.
If you use a text editor (often used for HTML creation and a standard tool for programmers) you can use GREP to strip out extraneous css styles.
Google Drive's free Doc's word processor format has an HTML export function; it's not bad and it's much cleaner than MS Word is, and is especially useful for Mac users attempting to move from MS Word to HTML.
There's a tutorial from OpenSource.com on how to make ePub format ebooks using free open source tools.
IBM has a technical but usable tutorial on building epub books.