how do advertisements alter history?

I doubt if ordinary ads -- like for toothpaste or softdrinks -- have much effect on history, except to make companies richer and sell stuff like cigarettes that is bad for our health.

However, ads sponsored by the government and political parties have changed people's opinions and habits. Buying savings bonds and working in wartime factories were heavily advertised during WWII. Rosie the Riveter was a prime example. It's possible that the Swift Boat ads against John Kerry influenced voters enough to get George W. Bush elected president for a second term.