Not all ebooks are published in the same format, so where you shop will to some extent depend on the type of ebook reader you have.
The ePub format
Most ebook stores sell ebooks published in the ePub, or 'electrical publication', format, an official standard of the International Digital Publishing forum (IDPF).
This industry standard format is the most widespread, and used by almost all the main stores: Apple's iBooks, Kobo, WH Smith, Foyles, Waterstones, Google Play, eBooks.com and Uncuva for Android devices.
Using this open format means ebooks can be downloaded into one library - wherever you shop - and moved between devices if you decide to upgrade your ebook reader. But ePub content can't be downloaded onto the Amazon Kindle, which uses its own format.
Amazon's AZW format
Unlike the other ebook stores, Amazon's Kindle store sells ebooks published in its own proprietary format, AZW. This is the only format that the Kindle accepts, so buying a Kindle ties you to the Amazon store for your ebooks.
The Kindle app lets you read Amazon ebooks on different devices. You can still shop on Amazon if you have a different brand of ereader, but you'll need to download an app for buying and storing ebooks bought on Amazon.
If you decide to shop elsewhere, you'll end up with two separate libraries that split your ebooks up, so you won't be able to search across all your titles in one go.
Other stores with linked devices
Amazon isn't the only store to have its own dedicated ereader platform linked to its own ebooks store; Apple's iBooks stores ebooks in your iPhone or iPad's iTunes media library, and Kobo has its own store linking to its ebook reader device.
But as these stores sell ebooks published in the widespread ePub format, any titles downloaded from different stores are merged in the same place on your ebook reader.