How Search Engines Work
There are billions upon billions of pages on the web. It is impossible for a person or a group of people to go through each page and rank the importance of that page based on a variety of variables and contexts. Instead, a search engine is constantly updated by several "spiders" or "bots"(short for robots) that quickly scan web pages for specific content. The process of scanning is endless and they will constantly scan the same site over again at various intervals.
What Search Engines Look For
Every search engine is different. Each has its own criteria for determining what results are pertinent to the visitor. There might be slight variations in the methodology behind how search engines rank content, but there are two key concepts that will secure a high ranking among all of the search engines.
Contextual Keywords
A spider scans a specific web page looking for what the page is about. Afterwards, it counts the total number of keywords associated with that concept. In the case of a plumber's website, the spider will look for keywords associated plumbing such as the following; clogs, pipes, pump, water, drain, drainage...etc. The search engine ranks that page on a scale of importance based on the keyword density, or the ratio of specific keywords to other content on the page.
The more times you mention a specific keyword or key phrase, the more a search engine will consider that page to be of importance. However, there is a drawback. If you fill your content with a bunch of repeated keywords and your content goes over a specific ratio of keywords to content, the search engine may consider your website trash or an attempt to maliciously take advantage of the search engines, and temporarily blacklist your website until you fix the problem.
Link Popularity
Another factor which increases the importance of your webpage in the eyes of the search engines is the link popularity of your website. If more people are linking into your website from their website, the more important your webpage will appear and the higher your webpage will appear in the search engines.
However, it gets a little bit more complicated. While, simply linking to your website will increase your popularity, you can specify keywords or a phrase to increase your overall ranking for that terminology. If several people link to a specific page within your website with a specific phrase, your website will rank highly for that key-phrase associated with the link - regardless of what your website is about.
The Search Engine In Action
Let's pretend the drain in your bathtub is clogged and you have a tub half filled with stagnant water. Seeing as how you need a plumber, you turn to the web for assistance. Because you live in Pittsburgh Pennsylvania, you're going to use your location as part of your search criteria. In the search bar you type the keywords: "plumber" "Pittsburgh PA" "clogged drain." The search engine will then provide a list of results based on the keywords you just entered.
These results are pulled from an extensive database, and then ranked based on both the prevalence of your keywords as well as the link popularity of the websites. Links with a higher higher link popularity and keyword to content ratio will appear higher in the search engine rankings than sites with a lower keyword count or pages that are not nearly as popular.