It builds a profile of your viewing habits through Automatic Content Recognition (ACR). Smart TVs also track how you use the device itself, including the apps you use, the channels you watch, and how long you spend watching. If your TV has a microphone, even your voice commands can be recorded.
Some smart TV manufacturers sell anonymized profiles to data brokers and advertising companies. These companies then use them for ad targeting. Alternatively, many smart TVs have built-in advertising platforms. Advertisers can purchase ad space on these platforms and target their ads based on your profile.