Ummm... Both? And more!
Expanding on what l_e_cox said above, by a strict economic framework, we are the contractors, our data is the commodity *and* we are the customers.
1.) You clicked "I Agree" to the license agreement when you signed up for Google's free service(s): You are a contractor to Google. You will provide Google with: Query data (for/from the search engine), a known-good email address (for/from GMail) and usage statistics (From other Google services). The fact that you gain benefit from this is the reason you want to continue to do it, which makes Google want to continue this relationship.
2.) The data that is generated is the commodity being sold to the advertisers. And, it's not just *your* data, but an aggregate of *ALL* the data that they get and have to sift and sort and group and classify until it is palatable to *their* customers; the Advertisers.
3.) Now, why do the Advertisers buy this commodity? Because they want *you* to be *their* customers! They know that you are looking, you are using Google's service. They *hope* that the information they paid for is targeted well enough to get you to stop and look further instead of click past their ads. Can the Advertisers tell *exactly* what you were looking for that made your email and/or account a part of their purchased advertising package? I highly doubt it. I doubt that the data/lists that Google sells has that level of granularity to it because in that format, it wouldn't really be palatable to the Advertisers. They don't need extra work. They just need another method of advertising their products/services. They've already come up with what they think is a winner as far as their ads, they just need to get it to the right people. (They hope.)
Say you are an advertiser for a company that sells shoes. You go to Google and want to buy some data on potential customers. They provide you with 20,000 accounts that have, in one fashion or another, been interested in shoes. Now, as many in Sales have told me, if you get 10% to actually click through the link and look at your site, that's successful advertising. So, now you have 2,000 potential customers on your site. Now its up to your site's layout, features and design to be able to close the sale. And, how many actually make a purchase? If you got 200 sales from this, many would call that a success. And, if you *don't* buy anything? If nobody buys anything? Well, if a particular method of advertising yields no sales, that method is abandoned.
So, you are the contractor to Google for the commodity you and your fellow users generate *and* you are a potential customer to the Advertiser's company. You are the consumer. You are the one that the companies doing the advertising are fighting each other to get to first. If you actually make a purchase from one of the Advertiser's companies, then they are happy, and they tell their advertisers to go back to Google and buy more data... And, so the great Circle of Business continues...