Google is the only multi-billion-dollar company in the world that is also a spelling mistake. Back in the palaeolithic era (that's the palaeolithic era in the internet sense, ie autumn 1997), its co-founders, Larry Page and Sergey Brin, were graduate computer science students at Stanford. They were working on an insanely cool new search engine, wanted to incorporate it as a company, and needed to find a name. David Vise, in his breezy book The Google Story, tells how they came up with one. A fellow graduate student suggested to Page and Brin that they use the name given to what is sometimes, erroneously or metaphorically, called the largest number, 10100: google. They looked up the name on the internet, found that it wasn't taken, and registered their brand-new brand, google.com. The next morning they found that the reason the name hadn't been taken was because it should be spelled googol - and that googol.com had, of course, already been bagged. Lesser men might have considered that a bad omen, but Page and Brin are not bad-omen kind of guys. A little more than eight years later, Google is the fastest-growing company in the history of the world - with, at the time of writing, a market capitalisation of $129bn. Page and Brin, the Wallace and Gromit of the information age, are worth more than $10bn each.

Companies are a bit like people in that they tend to bear the imprint of the milieu in which they were formed. Google, spelling mistake and all, is a product of the intensely academic environment in which both Page and Brin were raised. Page was born in Michigan, Brin in Russia, but apart from that their backgrounds were eerily alike: ethnically but not religiously Jewish, educated in Montessori schools, their fathers both university professors of science, their mothers both also supernumerate. Brin was 16 when he began taking classes at the University of Maryland, and 19 when he graduated. He went to Stanford to begin work on his PhD. Page, who had done his first degree at the University of Michigan, went there a year later to have a look at the computer science PhD programme. On a Stanford orientation day in 1995, looking around San Francisco, Page began arguing with the tour guide, a second-year PhD student whose opinionated obnoxiousness so closely resembled his own. You have seen enough buddy movies to know what happened next.

The key idea that underlies Google could occur only to someone thoroughly marinated in academic ways of thinking. John Battelle, an internet-world insider and search-engine specialist, gives a fascinating account of it in his indispensable book The Search. Page was fooling around at Stanford, trying to come up with an idea for his PhD thesis. He had always been interested in Nikola Tesla, a scientist whose list of brilliant inventions was not matched by the success he had in marketing them, or himself. Page had no interest in hiding his light under a bushel. He began to think about his own web page, and whether or not anyone was not just reading it but linking to it - which would definitely be an indication of a more than casual interest. So Page wrote a program that found out who was linking to any given web page. He called the program BackRub.

Once BackRub had been written, Page began to wonder if there was a way of using it to determine the utility of any particular site, and this is when he - or he and Brin - had a big idea. It was based on one of the most widely mocked areas in academia, that of bibliometrics: assessing the importance of any given article or piece of information purely by measuring how often other people in the field mention it. This never-mind-the-quality-feel-the-width approach sounds like a ridiculous way of assessing the importance of intellectual work but it is, I am told, a surprisingly powerful tool. In any case, it is what gave Page and Brin the idea for a program that measured the importance of a web page by counting how often other web pages linked to it. Page gave the mathematical algorithm that worked out this problem the name PageRank.

Then the boys set out to build a search engine that used PageRank. (The patent for PageRank, incidentally, is owned by Stanford University. Google have exclusive use of it until 2011.) The idea was that a search engine that knew how important a page was would have a powerful advantage in assessing the quality of the information on that page.

The 'crawler': how it works

As for how it works in practice, the first thing to realise is that Google does not search the internet. If it did, the internet would grind to a halt under the strain of all the searching taking place, because Google alone makes upwards of 100 million searches every day. Instead, the program searches a copy of the internet stored on its own computers. It sends out a "crawler" that downloads copies of internet pages. A full circuit of all the web pages in the world takes roughly a month, which is why the information on Google is often a few days old; the most recent snapshot of the page copied back to the Googleplex is available as the "Cached" link on any given Google result.

Next, Google makes an index of every word on a web page, where it stands in relation to other words, whether or not a word is listed in a title, whether it is listed in a special typeface, how frequently it is listed on the page and so on. It also gives a lot of importance to the PageRank of the page in question. There are more than 100 of these criteria, and Google gives a numeric weight to every one of them, for every searchable term on every one of eight billion web pages. When a query arrives - which it does at the rate of many times every second - Google searches the index for the relevant terms, measures the relevance using all its various metrics, crunches out a single number for each page, and lists them, with the highest score at the top, usually within half a second or so.

Even if you didn't know a thing about computers, you could tell this involved a truly scary amount of computational power. When the program was first conceived, Page thought he would be able to download an entire copy of the internet to his own PC. That turned out not to be the case: Page and Brin ended up having to scrounge, cadge, rustle up and "borrow" every scrap of computational power they could find at Stanford to gather the necessary data. What they learned in the process became one of their great strengths. Google does not run on huge, expensive mainframe computers but on a very large number of bog-standard, over-the-counter PCs. The PCs are tweaked and cabled together in particular ways and run a customised, stripped-down version of Linux. When a PC breaks, they chuck it away and replace it. Nobody knows just how many of these PCs Google has. John Hennessy, the president of Stanford and a Google board member, says that it is "the largest computer system in the world" - Vise puts the figure at more than 100,000 PCs. Its main problem these days is the heat generated by all those silicon chips.

The boys took the company public in 2004, leaving it as late as they could, this being one of the many ways in which Google diverged from the Silicon Valley norm during the long-lost boom. The general pattern during the internet gold rush was to launch a company as early as possible and hope that investors bought the shares before the company ran out of cash. That was because most dotcoms had no money; their business model involved truly spectacular revenue projections, set some distance in the future.

Small ads, big business

Google's route was superficially similar. It concentrated on making its search technology the best. Traffic to the site grew at great speed, all without a cent spent on marketing. The company had as yet no business model; as one of its directors said: "We'll figure out how to monetise that." This was exactly the thinking that cost so many people so much money. The difference was that Google managed to do it, and they did so by building a huge business in the most nickel-and-dime way imaginable: through small ads. Next time you do a search on Google, have a look at the "sponsored links" on the right of the results. These are paid advertisements. The ads have been bid for by people who bid for specific words, or combinations of words: 75c (41p) for "digital camera", to take an example from The Google Story, but $1.08 for "digital cameras" (because people who click on the plural are actually more likely to buy them), or $30 for "mesothelioma" (because the people who place the ads are personal injury lawyers looking for clients who want to sue whoever it was they think gave them this particular cancer). If you click on one of the links, the advertiser pays Google the agreed amount.

The success of Ad Words (as it is called) is the reason Google, instead of rushing to the stock market as quickly as possible like everyone else did, took as long as they could to go public. They knew that as soon as their revenue figures were disclosed, everyone would go nuts, and their competitors would begin knocking themselves out to get into this amazing new business of search-plus-ads. Their secret was the opposite secret from every other internet start-up: they were already making a tonne of money. They have continued to do so. Google in the six months to June 30 2005 earned $2.6bn, almost entirely from its ads. It was sitting on more than $3bn and had no borrowings, and it has since raised another $4bn in cash. This sheer financial muscle is the reason Google is now such a power in the world.

The financial success of Google since its IPO means that the limits on what Page and Brin can do are set not by what they can afford but by what they can conceive and bring off. The stated mission of Google is "to organise the world's information and make it universally accessible and useful", an immodest project to put it mildly, but one on which Google is at least in a position to make a decent start. But the company's philosophy is to give bright people a free rein to attack the problems that interest them, and 20% of employees' time is devoted to pet projects of their own devising. This means that the company is constantly coming up with new schemes and wheezes, which tend, at the least, to be interesting ideas. It also means that barely a day goes by without a news story touching on Google in some respect or other.

Since I began writing this piece Google has been in the headlines several times: for governments' complaints about the spy-friendly -potential of the all-too-detailed satellite maps in Google Earth; for a new feature called Music Search, which does what it says on the tin; for announcing a plan to take a 5% stake in AOL; for being vulnerable to "black hat" tactics from Search Engine Optimisers, who specialise in boosting Google results; for hugely expanding its nascent Google Video service; for a dispute with the US government over data; and for this week's rollout of a restricted Google site to China. The media are obsessed with Google, not least because they are so worried by it. (The general consensus is that Google, having once been seen as a technology company, should instead be regarded as a media company. You may not think it matters, but money people like to see things through the prism of a "business model".) Other recent stories have concerned the company launching Google Talk as a potentially disruptive way of making free phone calls over the internet, pressing on with its ambitions for Google Book Search (formerly Google Print) to "make the full text of all the world's books searchable by anyone", and launching Google Base to take over the world's classified advertising market. In the meantime, the company has launched a Toolbar, including a Desktop Search tool that searches for information on users' own PCs - something Microsoft, the world's biggest software company, has been trying and failing to do for a number of years.

What scares people about this is the feeling that Google has a masterplan, and that it is advancing towards world information and financial dominance. It isn't clear that that's right, though. My sense is that Google advances more by letting its engineers invent things and solve problems one at a time, and that as long as the problem being solved broadly fits with the overall mission statement, it will go ahead with it. Some of these stabs seem well thought out, others less so. At the same time the core focus on search stays. People who work in the field say that search is only 5% "solved", and that the huge amount of information located on the internet, but (for a variety of reasons) unavailable to searches, remains an enormously difficult problem to solve. It seems likely that this focus will give the company plenty to chew on for many years.

A tool for everything

So: is Google a good thing? It certainly has made finding information incomparably easier. Google Scholar, which searches academic papers, is very useful, and will become more so. The powerful calculator feature, which will do advanced maths as well as highly practical things such as converting square feet into metres, is useful. Google News, which was invented by an engineer, Krishna Bharat, using his 20% time to come up with a broadly global news service in the wake of 9/11, is useful, and terrifies conventional news organisations. The translation service isn't useful yet, but I bet it will be one day. The command "define" is a useful, quick way of finding what a word means. The blog search is fairly handy and will get better. Google Earth isn't particularly useful, but it is brutally cool: you begin with a satellite view and gradually descend to earth, homing in with a level of detail that can give you a view of your own house (also, it turns out, of secret military installations). Gmail, with its super-swift searching and 2GB of free space, is amazing, if you don't mind the fact that your email is scanned and used to target ads (and stored indefinitely).

Google Maps is useful, and, because Google lets people adapt its programs in ways they find personally helpful, will grow more and more useful over time. Froogle, the shopping search service, is sort of useful, and has a feature that chills the blood of conventional retailers: when you're out in the high street and see something you want to buy, you can text it and Froogle will text back the best price it can find online. Also cool is Google Zeitgeist, which tells you which search terms have most increased in frequency in the past year. For 2005 the top five items are Myspace, Ares, Baidu, Wikipedia and Orkut - all of which, I notice in my trendspotting hat, involve some sort of sharing, searching, meeting or collaborating online.

Technologically, Google is an amazing thing. As for whether it is a good thing, that depends on what happens next. The company is keen to stress that, because of the voting structure of its shareholdings, it remains in the control of its founders. It is keen to send little signals of its own geekiness: its official IPO filing, for instance, announced that it would sell $2,718,281,828 worth of shares - a number based on "e", the so-called natural logarithm, a number intimately familiar to maths nerds.

But this strength of the firm - its rootedness in grad student nerd culture - is also a weakness, in the form of a certain arrogance and unwillingness to pay attention to views emanating from lesser forms of life. The example of this currently preoccupying the publishing business is Google Book Search, the plan to scan all the world's books and have them available for search. This sounds ambitious, to put it mildly, but Google has the resources and the determination to do it. It is digitising millions of books at the universities of Michigan, Stanford and Oxford, and has already begun providing access to the out-of-copyright volumes. Google began to digitise currently copyrighted books in America until it was stopped by a lawsuit from the American Association of Publishers.

A fundamental clash of cultures is at work here. To Google, it is obvious that books, which contain so much information, must be searchable online. The plan is not simply to give the books away: although the whole book will be scanned and stored, only specific fragments of text will be displayed. It will be the best shop window ever for obscure texts. But to publishers, there is something outrageously hypocritical about the contrast between Google's ferocious protection of its own intellectual property rights and its contempt for everyone else's. What's to stop Google giving free online access to the books once they are scanned? At the moment Google says it has no intention of providing access to this content; but why should anybody believe it?

China: a risky venture

This is one reason why Google's activities in China have the potential to be such a disaster for the company. The story which broke yesterday - that Google's new Chinese internet servers will cooperate with government censorship - was no surprise to people with an interest in the subject. For one thing, Google has been cooperating with Chinese censorship of its news service since 2004; for another, Google has, since last June, been part-owner of Baidu, China's biggest search engine, which is, famously, lavishly compliant with the censors. But these facts weren't widely known, and Google had still, to a remarkable extent, retained the public aura it claimed by adopting the motto: "Don't be evil." If people start to think that it's real motto is, "Don't be evil except when there's serious money in it," they will see Google differently, and trust it less - and Google badly needs people to trust it.

That is partly because the biggest area of concern about Google involves privacy. An op-ed piece in the New York Times in November brought to wider notice the fact that Google logs all the searches made on it and stores this information indefinitely; and Google installs a cookie on the computer of everyone who uses it, which helps log that user's searches. Because every computer has a unique IP address, every visit to every website can be traced back to the computer making it - a fact which is well known in geek circles but remarkably under-publicised outside them. Users of Google's Gmail service, who have their emails scanned to place targeted ads, have already given the company their identity, a full record of all their searches, and copies of all their emails, stored indefinitely.

It is over the issue of money-making that the question of privacy will bite. So far, everyone who has invested in Google has made out like the proverbial bandit; but one day the share price will drop, and people who've bought shares will find that they've lost money. It is then that Google's leaders will come under pressure to find some uses for that unprecedented goldmine of personal data.

Google is belatedly waking up to the touchiness of all this. That's why the company reacted more firmly than its competitors in August when, it emerged last week, the US Department of Justice subpoenaed the company for a list of every website address available on Google and every search term entered into Google for June and July last year - a request later narrowed to a random list of a million websites, and all the urls available in a given week. The US government was looking to assess the prevalence on the internet of "HTM": this acronym means "Harmful to Minor", meaning pornography that children can accidentally access over the internet. The US government in 1998 passed a law on how this material should be blocked; in 2004 the Supreme Court overturned the law on the basis that a system of filters should be used instead; this subpoena was part of an attempt to show that the filters don't work.

It turned out that AOL, Microsoft and Yahoo! had all already complied with similar requests. To many, this seemed the privacy apocalypse campaigners have long feared. It isn't, since the DoJ subpoena specifically omits information that would identify who is doing the searching. But it is an incredibly worrying sign, not least because it shows the way governments might come to use search engines as a form of privatised surveillance. In the post-Google world, the risk is that governments won't need to spy on us themselves: they can let the search engines gather the data and then slap a subpoena on them to suck up all the information they want.

The news about the DoJ subpoena caused Google's share price to drop 8.5% in one day, and the company is now worth $20bn less than it was when I wrote the first paragraph of this piece; which is the stock market's way of saying that the more people think about their privacy, the worse news it is for Google. Possibly, just possibly, there is a glimmer of hope in the prospect that Google will realise it has to protect users' privacy in order to protect its own share price. But the contest between governments, search engines and users' privacy has barely begun.

Google is cool. But Google also has the potential to destroy the publishing industry, the newspaper business, high street retailing and our privacy. Not that it will necessarily do any of these things, but for the first time, considered soberly, these things are technologically possible. The company is rich and determined and is not going away any time soon. It knows what it is doing technologically; socially, though, it can't possibly know, and I don't think anyone else can either. The best historical analogy for where Google is today probably comes from the time when the railroads were being built. Everyone knew that trains and railways would change the world, but no one predicted the invention of suburbs. Google, and the increased flow of information on which it rides and from which it benefits, is the railway. I don't think we've yet seen the first suburbs

· This is an edited version of an article that appears in the current issue of the London Review of Books (lrb.co.uk)