Programmatic advertising works by using software to buy and sell digital advertising space. Advertisers set up campaigns with targeting criteria, such as audience demographics and interests. The software then bids on ad space in real-time auctions, using data to determine the value of each impression. The winning ad is then served to the user.