EPUB (sometimes written as ePub) is an open-standard format for eBooks, which uses XHTML. You can write one using tools that came with your operating system, but that requires knowledge of the various markup elements. Most people prefer to use 3rd-party software to convert their books to the EPUB format. Some of this software is free, others you have to pay for.
I've tried several of the free option, and the one I like best is Sigil. It's an open-source eBooks authoring tool under GPLv3 (General Public License version 3). What I like about this software, is not only can you write your book using the WYSIWYG (What You See Is What You Get) editor, but you can also view the XHTML code and write the book directly from code (for the advanced users). Whereas most of the software I've been for EPUB books have consisted of converting PDF or .doc files, Sigil lets you write the actual book; you don't have to write it in another format first and then convert it. This also means that it's easy to make edits to a book you already formatted to EPUB and save changes without having to reformat again.
This software is useful for both professional publishers that want an easy way to make eBooks to sell, as well as the average person that just wants to add some content (such as a shopping list, or driving directions) to their iPhone. Yes you can add PDF files to your iPhone, but it's not as pretty as an EPUB book.