Lovely Infographic which explains what happens when you search Google and some of the statistics behind the amazing feats of engineering they've cobbled together to give split-second search results from a 100,000,000 GB database.
Most of Google's search results are based on Indices. Each Index is a list of keywords, locations and pages that they relate to. When you search using a keyword (keyword is plural in search lingo - and a keyword can be one or more keywords, also known as a keyphrase), Google returns the results of an index or the results of pages in the indices your phrases matches.
So in essence, the index is pre-built. Google just applies rank order and geo-location to filter the results. So in most cases, if you're searching from Ireland, pages from the same country are given higher priority. Results priority are given in the order that suits the query, not necessarily the site or page with the highest PageRank.
To assemble this index, Google stores all of the relevant data with the keyword and web address. This is what makes it tick so fast. It doesn't really have to search, most of the computational mathematics have already been performed.
When Google processes each page, it determines what keywords on each page are strong or relevant enough. It also looks to see how popular it is and then gives it a score. It also decides which countries that its relevant to.
Google also has to then do the same keyword matching with its AdWords database as well as its Google Local (Zagat/Places) database. It also pulls relevent data from its news feed (especially for QDF) and from YouTube and Images. This data is then compiled into the search results you see.