Although Google focuses on three key areas: Search, Ads, and Apps, Search is its core technology; Ads are their central business proposition, and Apps are the umbrella over their web-based software that you can access anywhere any time.
How Google Search works
While each of these has a lot of technology under the hood, the basic tenets for Search, Ads, and Apps are very simple. Google has created some short videos explaining the principles behind our core services.
The life span of a Google query is usually less than half a second, yet involves quite a few steps that must be completed before you see the most relevant results.
These ranking systems are made up of not one, but a whole series of algorithms. To give you the most useful information, Search algorithms look at many factors, including the words of your query, relevance and usability of pages, expertise of sources, and your location and settings. The weight applied to each factor varies depending on the nature of your query—for example, the freshness of the content plays a bigger role in answering queries about current news topics than it does about dictionary definitions.
Watch the video to get an idea of how Google search works.
This video by a Google Engineer throws some more light.
For more details about the algorithm, etc, visit Google.com.