How do citations get counted for a book and for an electronic book?
The answer varies with the service you use. I only know something about two services:


Google scholar: It crawls the web to get a database of publications and citations (and it often counts something as publication which is not one, e.g. slides, lists of presentations…). I guess (but I am not sure) it also gets formatted data from publishers. It tries to identify similar publications (I have no idea how this is done precisely) and it also relies on user input (you can identify two things as the same by yourself if you have a verfied account and Google thinks that you are an author). In my experience, the database Google scholar is quite messy. Wrongly identified authors, lots of non-publications, double or missing citations.
MathSciNet is a service for publications in mathematics run by the American Mathematical Society. It gets data from the publishers and imports it automatically into their database. It has people to check the database, to identify duplicates (very rare, basically only reprints), to keep different authors with same names different and to identify authors who appear under different names or spellings. This is done by hand and also uses user input. As GEdgar points out: MathSciNet is very accurate and pretty fast to fix things.