The biggest factor was nationalism. The USSR was one large super-state made up of many smaller states that had been independent countries in the past; sort of like the United States, if Texas, California, and Idaho had all spoken separate languages for centuries and considered themselves, to varying extents, different races before being united under one federal government.
As you might imagine, there were plenty of people in each of these states that resented being united in this way or felt under-represented — Russia had clear preference in most affairs and dominated the union — and wanted greater independence.
The USSR had a special arrangement with a variety of neighbouring countries — East Germany, Czechoslovakia, Bulgaria, Hungary — called the Warsaw Pact.
This pact basically said that “If you attack any of us, you attack ALL of us and we will all declare war on you together.” The USSR was by far the largest force here — it’s as if the USA had that deal with Canada and Mexico.
So what it really meant was that the USSR promised to protect those countries, in exchange for some authority over their military affairs and strong influence on them. They were popularly called the USSR’s “satellite states” — they weren’t part of the USSR, but the USSR had major influence on them. It was like a mafioso promising to protect you from your enemies, in exchange for you ‘owing’ him favours.
Now in the 1980s, a new wave of Soviet politicians arose who opposed the totalitarianism and oppression of the past, especially the abuses of the Stalin era, and wanted a new, open, accountable form of communist government. This wave espoused three big slogans and programs: Glasnost (openness/transparency), Democratizatsiya (democracy), Perestroika (restructuring/reorganisation). More open elections and citizen involvement, fewer secrets, clearing out corruption, those were the goals.
Many human rights abuses and problems with the society and its leaders (especially Stalin) were openly taught and discussed for the first time, which started to ebb at patriotism and cause a public divide between the old generation and the new generation, and a government divide between the conservative hardliners who thought this was all a mistake and the glasnost supporters. This served to only intensify the big debate taking place in the new more democratic society — the debate over nationalism.
As part of the new initiatives, the USSR’s leader, Gorbachev, promised to stop intervening in the affairs of the satellite states and leave them more independent — but this also meant, as part of the compromise, reducing or removing the Red Army’s guarantee of protection. So they gave the nationalists and anti-Soviet voices more prominence both within and without the country, while giving the satellite states less reason to need them. Countries like Poland started electing governments who were anti-Soviet or at least not aligned with the USSR, as previous governments had been.
When this started happening, it fanned the flames within the USSR, and the USSR’s republics/states began breaking off — the communists lost elections in the Baltic and Caucasus states, which began becoming independent nations. This was when the USSR started really breaking up.
What really made it collapse, though, was the coup d’etat. In 1991, the conservative hardline members of the government, totally opposed to all these bleeding-heart changes that were weakening the USSR and its military pacts, staged a coup to remove Gorbachev from power and abandon his new initiatives.
They were fiercely opposed and the coup failed, but it absolutely destroyed confidence in the government, and many more states declared their independence. The president of Russia, Boris Yeltsin, was a fierce opponent of Gorbachev’s himself and banned the current party from doing activity in Russia and eventually declared its independence also.
In the background of all this is the decline in oil prices, oil being vital to the USSR, and escalating military budgets causing food shortages and declines in healthcare and quality of life standards across eastern Europe. It’s a big complicated issue. If you want a proper detailed explanation, Armageddon Averted by Stephen Kotkin is utterly fantastic (and then move on to his three-volume biography of Stalin, still in progress, for more detail on the USSR, and Sheila Fitzpatrick’s Russian Revolution — the 3rd edition, after the fall of the USSR and her admission into the old Soviet archives — and Orlando Figes’s A People’s Tragedy).