This growing advertising business gave Google the confidence to expand its audience. Most significantly, in 2002, America Online brought in Google to replace Overture, which provided both search and search ads; that deal enshrined Google as the premier search engine and ad network. Google won the deal by guaranteeing AOL a substantial sum, which it would not disclose. Google was willing to make that bid only because of its confidence in its advertising sales prowess. "If we were wrong," Mr. Kordestani said, "there were some scenarios that would bankrupt the company."

But by that point, Google had figured out that the same sort of computing and engineering skill that it used to find Web pages could also be used to improve the quality and, ultimately, the profitability of advertising. "Initially, we didn't understand how fundamental the computer science was in advertising," Mr. Schmidt said. "We didn't have enough staffing or focus on this area. I managed to fix that."

GOOGLE introduced its current system for determining which ad to show on which page late last year. It is a wonder of technology that rivals its search engine in complexity. For every page that Google shows, more than 100 computers evaluate more than a million variables to choose the advertisements in its database to display -- and they do it in milliseconds. The computers look at the amount bid and the budget of the advertiser, but they also consider the user -- such as his or her location, which they try to infer by analyzing the user's Internet connections -- as well as the time of day and myriad other factors Google has tracked and analyzed from its experience with advertisements.

"If someone is coming from a particular location, a certain ad may be more popular there," explained Jeff Huber, Google's vice president for engineering. "The system can use all the signals available, and the system itself learns the correlations between them."

This technology is both amazing and potentially frightening. Google already collects and keeps vast amount of data about what Web pages and advertisements each of its users click on, and it can evaluate that history -- and compare it with that of hundreds of millions of other users -- to select the ad shown on each page. For now, Google says it identifies users only by a number in a cookie it places on each computer that uses Google. It says it has not connected the vast dossier of interests and behavior to specific users by name. But that could change as Google offers more personal services -- like e-mail messages and social networking -- and works more tightly with partners who already have such personal information.

Lauren Weinstein, the founder of the Privacy Forum, said the data that Google collects creates troubling privacy issues, especially because it declines to say what data it keeps or for how long. "If you start to target people based on a corpus of data, it can be abused in various ways internally and externally by organizations and government agencies," he said. Government investigators and lawyers in civil suits regularly get court orders to force Internet companies to reveal e-mail messages and other personal information about users.

Google recently rewrote its privacy policy to make it easier to understand what data it collects, but it did not scale back its data retention. Nor did it, as Mr. Weinstein and others have demanded, give users the right to see the data collected about them and their computers.