Building an alternative to Google? That means cURLing a lot of web pages, parsing them for the information, building a database, and indexing that. For the first part, you want to study "web crawlers" and "spiders", which are forms of bots (robotic web processes). The latter is just database stuff, but doing it on any scale gets into Big Data ... there's a reason that the history of Hadoop includes papers from Google Research.
I think some apps (especially mobile applications) subscribe to an ad service, rather than trying to sign up a bunch of advertisers directly.
/dps