Google follows links and discovers URLs by reading sitemaps. Google crawls through the web looking for relevant pages and indexes them.