So, I know that the Soviet Union was dissolved as a country in 1991, but I’ve always been pretty unclear on HOW exactly that dissolution happened and which means were used to actually split up the Soviet Union into/create the borders of all of the separate countries that exist in its place today.
In terms of where the borders came from: the USSR was made up of fifteen constituent republics in a federative union, and the borders between those republics had been established some decades before 1991. Essentially what happened is that the union was dissolved, and the fifteen republics became fully independent, although the terms of the dissolution meant that the other republics recognized Russia as the legal successor to the USSR (inheriting its UN Security Council Seat, embassies and foreign assets, the nuclear stockpile and Soviet foreign debt).
It's a very broad question, so please excuse a list of linked answers I've written on various aspects of this topic:
Why didn't/couldn't Chechnya break free after the USSR collapsed, like the others?
What Happened to Lawyers and Judges When the Soviet Union Fell?
Why Did Russia Get The Soviet Union's UN Security Council Seat?
What Happened to Soviet Military Personnel on December 25, 1991?
Why Was Poland's Transition to Capitalism So Much More Effective than Russia's in the 90s?
What Was Life Like in the Former Soviet Socialist Republics After The Fall of the USSR?
How Did Yeltsin Gain Control of the Army/Police When Dissolving the USSR?
When the Soviet Union Collapsed, What Happened to the Communist Party and all Their Stuff?
The borders of the Soviet successor states had already existed, as internal borders delineating the constituent Soviet republics of the Union. The Uzbek SSR and Belarusian SSR were, for example, entities with defined borders and republic-level government structures prior to the collapse of the USSR that became the Republic of Uzbekistan and the Republic of Belarus after the collapse.
Bypassing a lot of why this happened, the actual legal instruments that ended the USSR were the Belovezha Accords and the Alma-Ata Protocol (this translation contains both). The former states:
We, the Republic of Belarus, the Russian Federation (RSFSR) and Ukraine, as founder States of the Union of Soviet Socialist Republics and signatories of the Union Treaty of 1922, hereinafter referred to as the High Contracting Parties, hereby declare that the Union of Soviet Socialist Republics as a subject of international law and a geopolitical reality no longer exists.
and the latter:
With the establishment of the Commonwealth of Independent States, the Union of Soviet Socialist Republics ceases to exist
The heads of the Belarusian, Russian, and Ukrainian SSRs (Stanislav Shushkevich, Boris Yeltsin, and Leonid Kravchuk) met at the Viskuli state retreat, in the Belovezha forest, on Dec 8 1991, following a Ukrainian referendum in overwhelming support of independence, to discuss plans regarding their relations with (presumed to be soon formally independent) Ukraine, which ultimately resulted in their signing the Belovezha Accords, declaring the end of the USSR and establishing the Commonwealth of Independent States as its (non-sovereign) successor. This announcement was predicated on the notion that the three republics present were the same three that had signed the original 1922 treaty establishing the USSR, along with the now defunct Transcaucasian Republic, and therefore they had the right to collectively dissolve it.
Gorbachev and the Union government fiercely disagreed about the validity of this argument, but in practice the legal particulars of who had (or lacked) the right to dissolve the USSR don't matter much in light of what actually happened. The Belarusian, Russian, and Ukrainian Supreme Soviets approved the Accords, and Gorbachev declined to use force (beyond some very strong language) to reject this decision, not wishing to incite a civil war. On December 21, most (with the exception of Georgia, whose leadership was in the midst of being on the losing side of a coup d'etat) of the remaining constituent republics added their signatures and effectively dissolved the USSR, receiving international recognition (with the exception of the US, which felt it would be a slight to do so before Gorbachev resigned) as independent states shortly after. The government of the USSR retained its de jure existence (and US recognition as a sovereign state) briefly after, but following an ultimatum from Yeltsin (whose Russian Federation had, by this point, largely taken over the operational Soviet government apparatus) on December 23, Gorbachev agreed to resign and dissolve what remained of the Soviet government, formally resigning on December 25 (English text).
On borders, the agreement is pretty light, stating simply:
(Belovezha Accords)
The High Contracting Parties acknowledge and respect each other's territorial integrity and the inviolability of existing borders within the Commonwealth. They guarantee openness of borders, freedom of movement of citizens and freedom of transmission of information within the Commonwealth.
(Alma-Ata Protocol)
Recognizing and respecting each other's territorial integrity and the inviolability of existing borders.
with the borders in context being those of the signatories, i.e. the constituent republics. This wasn't an entirely foregone conclusion: the Abkhazian and South Ossetian separatist movements in Georgia, the Armenian-Azeri dispute over Nagorno-Karabakh, Pamiri separatism in the Gorno-Badakhshan region of Tajikistan, Chechnyan attempts to declare independence from Russia, and the Russian-Ukrainian dispute over Crimea were, and remain, significant. Yeltsin's advisors had asked him to raise the last point in particular with Kravchuk, but Yeltsin recognized that there wasn't a snowball's chance in hell of Kravchuk negotiating a second referendum for Ukraine's regions, and neither they nor the other heads of the republics had much interest in dividing their territories.
Further reading: