Webconfs.com does an excellent job of explaining exactly how a search engine operates. The first aspect of search engines that you have to accept is that search engines are not humans; they are mainly text-driven robots that search through websites to understand what they are all about. This is why it is so important to ensure that your site is content optimized.
The main progression that a “bot” or “spider” takes is: crawling, indexing, processing, calculating relevancy, and retrieving. These bots or spiders follow links from one page to another and index everything they find along their way.
It is virtually impossible for a bot or spider to visit every page, every day being that they are over 20 billion pages on the Web. Therefore, this is part of the reason why when you submit your site to the major search engines it may take up to three months to see that your site has been indexed. This is also why SEO efforts are sometimes not seen for a few months. So, do not be discouraged if you see little results after your initial SEO efforts. It is very unlikely that you will see any positive results right away.
Once your site is crawled, the spider indexes your site into a database. (Visit this Spider Simulator to see exactly how a spider will crawl over you site.) Basically, the spider identifies the words and expressions that best describe a particular page and assigns the page particular keywords in this stage. Next, the search engine process the page and compares the search string in the search request with the indexed pages in the database and ultimately calculates the relevance of each page to the search string using various algorithms. Finally, the search engines retrieve the results and displays them in the browser according to relevancy.