Search engines perform many activities in order to deliver search results. I visible to step by step work is perform in the search engine.
Crawling is most important in you website its means follow a path. In SEO word crawling means following your website all links crawling. This work is performed by free a software provide by Google, called a crawler or a spider or Googlebot in case of Google.
Spiders follow all links form on page all page in your website. You must be know if your website have 1000 pages so in the case you its is not possible to spider all page daily basic. So one think can spider or crawler in not human its is one reason we create site map, as it contains all the links of our websites and uses it to deep crawl our pages.
After your all page crawl you must be process of index for all the fetched web pages and keeping then into a giant database from where it can letter be retrieved. It is good idea for better search engine ranking your website be in index and do not index un-necessary archive like categories and all such page.
When a search request comes by any search engine then the search engine processes. And compare string in the search request in the indexed pages database. If your page not index in the database then Google no search your string.
The last step of work search engine is retrieving the best match result. Basically it is nothing more than simple display then in the web browser.