Why did the Soviet Union collapse?

There are a multitude of reasons for the collapse of the Soviet Union.  But historians have generally narrowed it down to the following major causes:

Rise of ethnic nationalism in Soviet Republics:  After decades of suppressing national identities, ethnic groups began asserting their nationality and demanded greater autonomy and political power.  This resulted in numerous riots and protests throughout the Soviet Union with demands for independence and national self-determination. 

Economic stagnation and fall of oil prices:  The centrally planned economic model resulted in massive shortages of staple consumer products.  Shops were continually empty and Soviet citizens needed to wait in long lines to purchase basic goods.  After years of economic deprivation, Soviet citizens were deeply angry at their government. In addition, oil prices declined significantly in the late 1980s, which provided the Soviet government a key source of hard currency.  This it made it difficult for the Soviet government to sustain high levels of military spending and keep the economy functioning. 

Perestroika and Glasnost: Gorbachev's reforms of the 1980s were intended to reinvigorate the Soviet economy.  However, they unintentionally triggered an opening of debate throughout the country.  The increased freedoms allowed people to more openly criticize the government and demand changes.  

Afghanistan and Chernobyl: In the late 1980s, two events symbolized the incompetence of the Soviet government.  The failure of the Afghanistan war resulted in a loss of confidence in the Soviet military. The Chernobyl disaster revealed the incompetence and duplicity of the Soviet regime, resulting in a further erosion of trust.