The way it is done is by an NLP process known as “anchoring”, plus image association.
First, the product, perhaps Pepsi or Coca Cola is shown, then the viewer is switched to an image of a sporting victory complete with wholesome sporting hero and uplifting music such as Chariots of Fire, the theme from “Rocky” or “Eye of the Tiger”, the product is shown again, then the sporting victory complete with music then the product and so on.
The process creates the same effect as Pavlov did with his salivating dogs who associated the ringing of the bell with the taste of the piece of meat.
People then associate the consumption of junk food and sugar filled unhealthy drinks not with obesity, flatulence and diabetes but with athletic and sporting prowess, Olympic success, fame, fortune and attractiveness.
In the end, the mere playing of the music is enough to trigger a response strong enough to induce that person to go into MacDonalds and order one of their cheeseburgers, french fries and a coke.