I've always thought the Austro-Hungarian Compromise of 1867 was an interesting solution, and lately I've been thinking about the feasibility of a nation under two governments. Was this sort of system feasible? Did any other country have success with it? Or was it unlikely to ever last long-term?
Ok this is an awesome (if huge) question and I'll try and answer it as concisely as I can. The short answer is: yes, it was sustainable, because it sustained itself for half a century. There were a lot of really difficult problems caused by the structure of the Compromise system, but we can never be sure how long it might've lasted, because the First World War broke out and destroyed the Habsburg Monarchy.
First, however, I've got to make a quick distinction. You're nearly correct in characterizing Austria-Hungary as "a nation under two governments." However, let me add a little bit of explanation so that you have a better idea of what Austria-Hungary was and why the Compromise was so interesting. To start, the Habsburg Monarchy was anything but a "nation." In the United States, we're not very careful about making the distinction between ideas like "nation," "state," "nation-state," "country," etc. However, the idea of a "nation" had a very specific meaning in the 19th century European context. Nation referred to an ethnic group, usually united by similar customs and, most importantly, a language. Examples of nations are "the Czechs," "the Germans," "the Hungarians" etc. Many nations in 19th century/early 20th century Europe also coincided with states, that is, a definable territory ruled by a specific government. Thus, the Germans had Germany (after 1871), the French had France, and the Swedes had Sweden.
The biggest problem to understand about the Habsburg Monarchy was that it specifically wasn't a nation-state, where one state represented one ethnic group. Rather, there were around 11 official nationalities that made up the Habsburg Monarchy. Although these maps can sometimes be a little misleading, it'll give you a sense of how mixed the ethnic groups of the Habsburg Monarchy were. So instead of Czechs ruling Czechs, Hungarians ruling Hungarians, etc. you had a German-speaking, Catholic dynasty (the Habsburgs) ruling a ton of different ethnic and religious groups.
Moving on, the idea of the Compromise was to establish two separate states with two separate governments, united under one Monarch. This came about for a whole slew of reasons, none of which really matter here, except for the fact that Franz Joseph felt the need to compromise with the Magyars (otherwise known as the Hungarians) in 1867, soon after the Habsburg defeat at the hands of the Prussian army in 1866.The Magyars were a sort of gentry (think some kind of mid-level noble) who had a strong sense of national pride. Even so, as we see from the map above, even the area within what became the "Hungarian half" of Austria-Hungary wasn't entirely made up of Hungarians. There were a ton of Germans, Croats, Serbs, Slovaks and Romanians living in what was called the Kingdom of Hungary. This is important later.
The barebones history is that in 1867, the Austrian Empire (as it was called from 1804-1867) split into two pieces. To save time, we'll use the short hand Austria and Hungary. This map shows the borders of the Austrian (orange) and Hungarian (White) halves. It also shows a blue chunk, which we'll get to later. Finally, this map is nice because it shows you the different states that Austria-Hungary broke down into after the First World War.
So keep in mind that you can ONLY call Austria-Hungary Austria-Hungary after 1867 and the Compromise. Before that it is the Austrian Empire, and before 1804 you can call it a variety of names. You can refer to the lands ruled by the Habsburgs as "the Habsburg Monarchy" during any period and you'll be safe.
The Compromise gave both halves a parliament, a prime minister, and the power to decide strictly internal matters within their own borders. The emperor retained the right to dictate a unified foreign policy (hence Austria and Hungary both going to war together against Serbia and Russia in 1914), command a unified army that drew conscripts from both halves, and a common finance ministry to handle the money for the previous two projects. Finally, it's very important to note that Franz Joseph I was the ruler of both halves of Austria-Hungary, but in different offices. He was the Kaiser (Emperor) of the Austrian half and the King of the Austrian half. He was literally crowned with a separate Hungarian crown in Budapest to signify this dual role. All official imperial documents and laws in Hungary bore the signature of the King of Hungary. Referring to Franz Joseph as the Emperor of Hungary wouldn't make you any friends in Hungary, and was technically incorrect to boot. This just reinforces how the Hungarians saw themselves: a unique, powerful, and proudly historical nation.
The plan looks good on paper, and you've hit the nail on the head when you say that it's an interesting solution. In fact, it's so interesting that it's been keeping historians busy for decades. There are supporters and detractors of the Compromise, but whether you like it or not, most people agree that it was innovative.
But let's tackle its problems, since you asked about its feasibility. Each half of the Dual Monarchy (you can also call Austria-Hungary this after 1867) had its own parliament. Boiling down a ton of history, I'll make two blanket statements about each one. The Hungarian parliament (or Diet, as parliaments are often called in Central Europe) was highly exclusionary. Remember that not only Hungarians lived in Hungary. There were also Serbs, Croats, Slovaks, etc. The voting requirements in Hungary, however, were incredibly restrictive, meaning that only Hungarian nobles made it to Parliament. Obviously, the other nationalities within the Hungarian half of the Monarchy were not happy about this. Think "no taxation without representation!" to understand why these people would be pissed. In the Austrian half, however, voting restrictions weren't quite so harsh, and more people could vote. The Czechs and Germans both had sizable representation within the Austrian Diet and (for reasons that I can go into in another post if you like) were constantly fighting with each other. In fact, the fighting was so bad that the Czechs boycotted the Austrian parliament for quite some time. Consider for a moment the position the Czechs were in after the Compromise. The Czechs were among the most industrialized, Westernized, wealthy, and nationalist groups in the Monarchy. When Franz Joseph concluded the Compromise with the Hungarians, the Czechs understandably felt left out. Why hadn't they been included in a three-way Compromise that would've resulted in Austria-Hungary-Czechia?
So now we've got a bunch of people pissed off at the Compromise. The Czechs, Serbs, Croats, Romanians, Slovaks are all jealous of Hungary's privileged position within the Compromise. The final key to this puzzle is the cooperation between the two halves of Austria-Hungary. By the terms of the Compromise, the two governments would meet every ten years to renegotiate certain aspects of their relationship. Usually, these issues boiled down to how many men each half would provide for the army, and how much money each half of the Monarchy would provide to pay for it. The Hungarians, thinking of 1848-49, when the Habsburg army had invaded Hungary to put down the Hungarian War of Independence, were hard bargainers when it came to agreeing what to do with the army. For every small concession they agreed to (a slight increase in the number of men Hungary would provide, for example) they would extract heavy promises from the Austrian half of the Monarchy. They were able to do this because (think back to the two parliaments), the Austrian half was constantly in turmoil between Czechs and Germans, while the Hungarian parliament excluded other nationalities. Thus, the Hungarians were able to present a far more unified front when bargaining with the Austrians. The result is that the army shrunk in comparison with other European armies, both in terms of size and armament. Going to war in 1914, the Austrian army was underfunded, under-trained, armed with many obsolete weapons, and lacking in the newest battlefield technology. It's a miracle they did as well as they did (which wasn't that great, but I'm getting ahead of myself).
Finally, the issue of Bosnia. Go back to the second map I posted and you'll notice the blue splotch at the bottom of the map. Without going into the history, Bosnia was annexed by Austria-Hungary in 1908. Sounds good, right? More territory? In fact, though, neither half really "wanted" Bosnia. Annexing Bosnia meant undertaking the administration of an underdeveloped, mountainous region; for the Hungarians, especially, adding Bosnia meant adding more Slavs to their half of the Monarchy. The ruling Hungarians saw each additional Slav as a further threat to their grip on power within the Hungarian half of the Monarchy. The result was that Bosnia wasn't annexed by either state and came under the administration of the Joint Finance Ministry! When the Finance Minister wanted to pour money into Bosnia to develop its infrastructure, administration, or economy, he was blocked time and time again by the Hungarians who had no intention of ponying up money for little Bosnia.
Continued below