The way it works on the iPad and iPhone is as follows. Your device generates a random number to uniquely identify it. It keeps tracks of what sites you have visited, what adverts you have seen and what apps you have been using. An advertiser can obtain that information using a feature called IFA or Identification for Advertisers. IFA doesn't identify you as an individual, nor does it identify your device in absolute terms (as in "this is an iPhone 5 owned by Fred Bloggs"). It is more along the lines of "this is an iPad number 123456 which has done the following". Apple would argue that this approach is less intrusive than other methods and there is some justification in that claim.
But maybe you don't like the idea of IAF in any shape or form. Can you switch it off? Yes, but how to do so is not obvious, as the setting is not in an obvious place (it is not under privacy settings as you might expect). Instead: Tap Settings. Tap General. Tap About. Tap Advertising. This takes you to something called 'Limit Ad Tracking'. Slide the switch to the right to turn it On. Done!
Note: this feature was introduced with iOS 6 and the instructions are not applicable to earlier versions of iOS.