Google uses the "Page Rank" algorithm to evaluate the quality of a page. This way when many pages are equally relevant to a search query, it can attempt to put the highest quality pages first in its results by ordering them by Page Rank. Unfortunately this does not work well because the Page Rank is not a good way to evaluate the quality of a page.
Why is Page Rank not a good way to evaluate the quality of a page?
Page Rank looks at how many other pages point to a page, the most pages point to it, the higher quality this page must be according to the Page Rank algorithm. However it is possible that a bad page has many links pointing to it and a good page has few links pointing to it.
It would seem logical that if a page was of good quality more people would have tendency to link to it. However how much weight do the links from "innocent users" have compared to the links of spammers or SEO specialists? Not only this method encourages people to spam the web with links to their page, but also it is not a good way to measure the quality of a page since we know that 1 motivated spammer can easily plaster links to his page all over the web, make deals with other sites to exchange links etc. When we are looking for a webpage, we want the page that will have the best content, not the page that belongs to the one who spams the most, or the one who makes the most deals with others, we don't care about that.
The result is that you can create a very high quality page, containing greatly useful information and no one will ever find it because there are not enough links to it. Google assumes that if your page is so good, more people will link to it, but people cannot link to pages that they dont know exist, so since your page has few links pointing to it, it will not come up in most searches, so not much people will find it and consequently not much people will link to it.
On the other hand if a very bad webpage has a lots of links pointing to it, despite the fact that its content is not very good more people will have tendency to link to it because more people will find it when they search for a variety of things.
It is a bit like the problem that many guys have in high school. Some guys are popular with girls so all the girls are fighting each other to be with them because they are popular. Some other guys dont have a girlfriend and never had one so none of the girls want to go out with them because they are not popular. It is very possible and quite probably the case that many of those popular guys are actually very bad lovers, but girls keep going for them while some of the unpopular guys would be great lovers, but no one knows because no girl wants to go out with them.
So in other words Page Rank encourages web spam and is a poor way of evaluating the quality of a page.
So then what would be a good way to evaluate the quality of a page?
Now we have established that Page Rank is no good but we have not come up with any "better way" of programmatically evaluating the quality of a webpage. While I do not pretend to know the answer to this question I can suggest 2 basic ideas of how to better evaluate the quality of a webpage.
A way to evaluate the quality of a webpage could be more based on the content of the page itself rather than on the number of pages that point to it. The crawler could analyze the content of the page a use a set of rules to evaluate its quality based entirely on its content.
Another way to solve this issue would be to, instead of trying to estimate the quality of a page at all, refine the relevancy calculation in a way that 2 pages would rarely end up being equally relevant, so the whole question of evaluating the quality of a page could be left aside in favor of only ordering the results by relevancy.