The one book that nearly all of these "bucket shop" databases are built upon is The General Amory of England, Scotland, Ireland and Wales by Sir Bernard Burke. This volume, published in the late 1800s, contains roughly 60,000 coats of arms, organized by surname.
The general method used by the folks who want to sell you "your family crest" is to delve into their database (which may also include J.-B. Rietstap's Armorial Général, containing some 120,000 coats of arms from all over Europe) and either print out the oldest coat of arms used by someone with that surname, or to print out the oldest coat of arms used by someone whose surname sounds similar. For example, if your surname was "Warren," you would probably be sold the arms of William de Warrenne, as his is the oldest attributed use of arms by someone surnamed, Warren (even though his direct male descent line died out in just a few generations). As an example of the latter, I know of an instance where someone with the surname "Scolly" was given the arms of someone surnamed "Scholar."
I hope that this gives you an adequate answer to your initial question.
David