Targeted advertising campaigns (microtargeting) are used by intelligence services, among others, to infect individual devices with malware.
More information
But it's not just intelligence agencies that use advertising to track people. Data brokers resell aggregated data about you and create profiles of you.