There are tons of different ways you can construct an .epub ebook, many of which may be confusing to jump head first into. This guide is designed to get you up and running quickly using a simpler design, with a competent enough understanding to create your own ebooks from scratch. I also have a basic template for ebooks here https://github.com/thansen0/sample-epub-minimal and you can learn about ebooks in-depth and special features http://idpf.org/epub, the official .epub document page. This guide is not for understanding the intricacies of .epub files, just a guide to get you started.
The basic .epub is just a zip file composed of .xhtml file holding content, and a few other files demonstrating the books structure, we'll get to the specifics of these in a bit.
.epub files are accepted on the majority of major ebook platforms, however many are moving toward proprietary solutions. The only major player to not accept .epub files on their reader is Kindle, however that is expected to change in the future. Currently Kindle uses their own .awz format, built off of the .mobi format they purchased earlier (the main difference being it's better at compressing the files). This said if you're looking to convert your .epub file over, you can always use a free software such as calibre, or if you're uploading to the Amazon Book store Amazon will convert it over for you.