The perfect search engine would lead you to every relevant location, ranked with the best sites at the top of the list, and would not include anything irrelevant. That engine doesn't exist and probably never will. Whether or not you are successful in locating the information you seek depends in part on which engine you use and how you construct your search query. It uses its own index or database or catalog that it has already compiled, which is why you get the results so quickly. These engines build their indexes using the keywords or meta data that they find on these pages.
People can also submit their pages.
These active engines are generally more current and have large databases. You may get better results because there will be fewer false hits and the sites presented will usually be the more major ones. However, they may not be as current because they do require human intervention. Most search engines are now a combination of these two types, giving you the best of both worlds, but some work better than others for different kinds of searches. For example, you might be looking for gardening sites in general, or specifically, how to grow hydroponic tomatoes.