Initially, search engines just checked if a website's contents contained search terms, but then webmasters just started spamming key terms to get to the top of search results.
While early search engines used information submitted or curated by webmasters and web users, they evolved to use bots that crawled the internet, scraped information, and informed search results.