At the conclusion of World War II, the Soviet Union and United States began the decades-long conflict of the Cold War. These competing systems fought for control over the rest of the world for nearly 50 years.
The failure of Communism in the Soviet Union was due to the economic system not only not responding to what the world market wanted, but to what the domestic market wanted. In fact, there was no domestic "market," the economy was entirely centralized and run by ministers in Moscow. Because they could not adeptly adjust to the requirements of supply and demand, the Soviet economy grew weaker and stagnated relative to the US, and finally collapsed in the 1990's.
Internationally, The "Brezhnev Doctrine" which supported the advancement of socialist governments, was countered by the "Reagan Doctrine" in the 1980's which sought to push back on Soviet expansion. Additionally, the military buildup by the US could no longer be countered by the Soviet Union. Under Gorbachev, the Soviet Union initiated perestroika or a re-structuring of the economy with democratic principles. Once in place, various regions of the former Soviet Union and its satellites broke away to become their own countries, most notably, the reunification of East and West Germany in 1990.