Search engines are based on three steps:
1. Searching Web
2. Index building
3. Software
When search query is submitted by user. To find information on the hundreds of millions of Web pages that exist, a search engine employs special software robots, called spiders or crawlers, to build lists of the words found on Web sites. When a spider is building its lists, the process is called Web crawling. The spider will begin with a popular site, indexing the words on its pages and following every link found within the site.
Once spider has completed the task of finding information, search engine assign weight to each entry on the basis of various factors such as title of the page, meta tags, sub headings, links and many more. Every search engine have different formula for assigning weight.
Search engine’s software is the engine’s user interface. The software sifts through the index in response to user searches and returns a listing of sites, based on what it finds most relevant.
Resources:
How Google Search works:
https://www.google.com/search/howsearchworks/
Bing Webmaster Guidelines
https://www.bing.com/webmaster/help/webmaster-guidelines-30fba23a