Google is the most popular search engine with more than 80% of the search engine market. There are 3 steps in which Search Engine works as below:
Crawl: Search engines work by crawling hundreds of billions of pages using their own web crawlers. These web crawlers are commonly referred to as search engine bots or spiders. A search engine navigates the web by downloading web pages and following links on these pages to discover new pages that have been made available.
Index: Webpages that have been discovered by the search engine are added into a data structure called an index.
Rank: Further ranking is done. The pieces of content that will best answer a searcher's query, which means that results are ordered by most relevant to least relevant.
To Summarize:
Search engine send the spider to your website
The spider takes note of your Title, Meta Descriptions, Keywords, navigation
All this information is indexed and then ranked to be served when users search for a query.