The Cold War ended primarily because the Soviet Union, America's adversary in the communist vs. democracy struggle, had a revolution in 1991 and broke into 15 separate countries. But that event was a long time coming, and the result of a combination of many factors.
First, the Soviet economy was weak from the start, but especially so after their war in Afghanistan. Mikhail Gorbachev took power in the mid-1980s determined to tinker with and save the Soviet system, but allowing some free speech and private ownership only opened the floodgates.
Eastern Europe was the first to go, in 1989. Peaceful revolutions (except Romania's) overthrew all of the communist governments in only six months. With the European satellites gone, events progressed rapidly. Some suggest the military spending required for the Soviet Union to keep up with Ronald Reagan's military buildup in America bankrupted them, but I tend to think it was the overall eocnomic system that was weak, and it ended because that weakness finally caught up with them.