When a user enters a search term, the search engine looks at the website page titles, contents and keywords it has indexed and uses algorithms (step-by-step operations) to produce a list of sites—with the most relevant websites at the top of the list. For an understanding of how search engines work, let’s listen to members of the search teams from Google and Bing: 

Source: https://www.bdc.ca/en/articles-tools/entrepreneur-toolkit/templates-business-guides/glossary/search-engine