Search engines crawl the web non-stop using software robots called spiders to read the web content, and then add additional information, such as the number of times the word appears on the page, and other weighing criteria to determine the ranking.
They will then compress and store the information in an index that will be used for retrieval during a search. An index is like a library index card with the book’s title, author, and the location of where the book is located in the library. In a similar but much grander approach, the search engine’s index identifies where on the web the pages resides that best match the keywords being searching for.
The amount of the page content and meta tag information to be stored in the index depends on the search engine. Some search engines only index the important words, while other search engines index every word on a page. But regardless of the technique used, an index has one purpose; it allows information to be found as quickly as possible. And to give you some idea of the volumes involved, a search engine like Google will index hundreds of millions of pages, and respond to tens of millions of queries every day.
When you enter a search query, search engines retrieve the most relevant webpages from their index and sort them based on several ranking factors. Having your website rank high in the search results is where SEO comes into play.