Search engines such as Google seek to increase its share of the total search market by returning the most relevant results for the keywords & phrases on which people search. They use 'spiders', (automated web browsers), to follow website links & add the information about the websites they find to their databases.
Importantly, the main aspect of the website on which they focus are 'THE WORDS'. Words in domain names, page titles, headings, body text, & links etc. It is for this reason that it's vital to ensure your website has been copywritten with this in mind. (More Info)
Search engines rank web pages according to their score for a search term. The score is a combined result of 'on-page' (i.e. content and page structure) and 'off-page' (e.g. inbound links) criteria. Web pages are assessed on more than 150 such criteria.