Keyword AdvertisingOverture (now part of Yahoo) was the first company to let advertisers bid to place their ads alongside search engine search results. Someone searches for "trampolines", and your ad for trampolines shows up above the first search results, for a fee. If someone clicks on your ad and visits your site, you are charged an advertising fee. You only pay when someone clicks on the ad and visits your webpage. This is called keyword advertising and is also known as CPC or PPC (Cost Per Click or Pay Per Click). The names mean what they say -- you pay when someone clicks on your ad, their is a cost for each click and visitor you receive. Initially, these ads only appeared on the big search engines, usually above search results (highlighted in a different color or something to denote them as paid listings or advertisements) or off to the right side of the screen. Google initially had no advertising on their site, but were lured by the big money available once their traffic grew and grew and they became the biggest search engine. They refined Overtures model and created the AdWords program, whereby advertisers could bid on keywords and phrases and have their ads show up alongside search results for those words and phrases. This worked well, allowing Google to show relevant ads to their tens of millions of daily visitors, bringing in billions of dollars in revenue over the years.
Google expanded the AdWords program to include other sites besides their own. Sure, they might dish up 100 million searches each day, but those searchers then left Google after clicking on some other site and then clicked through hundreds of millions of more pages. What if Google could also display ads on a bunch of other sites and domains? This led to the creation of the Google AdSense program, which basically expands AdWords to a whole network of partner sites who choose to sign up with Google and put the ad code on their pages. Google's trick to making a lot of money is to analyze the text and content of any given page, and then to selectively match the best advertisers from their millions of ad partners and display their relevant ads on that page. So a page about barbecues has ads about barbecues on it. With AdSense, Google hugely expands their reach to millions and millions of sites, instead of just Google.com.