The stability of Brazil makes me wonder what will happen in 2016 if Brazil is not in a position to play host to the games. Has this ever happened before? Are there contingency plans for such an event?
The 1976 Olympics are probably the closest example available. According to Wikipedia, Denver was originally scheduled to host the 1976 Winter Olympics:
The games were originally awarded to Denver in May 12, 1970, but a 300 percent rise in costs and worries about environmental impact led to Colorado voters' rejection on November 7, 1972, by a 3 to 2 margin, of a $5 million bond issue to finance the games with public funds.1
Denver officially withdrew on November 15, and the IOC then offered the games to Whistler, British Columbia, Canada, but they too declined owing to a change of government following elections. Whistler would go on to be associated with neighbouring Vancouver's successful bid for the 2010 games.
Salt Lake City, Utah, which would eventually host in 2002, offered itself as a potential host after the withdrawal of Denver. The IOC, still reeling from the Denver rejection, declined and selected Innsbruck, which had hosted the 1964 Winter Olympics games twelve years earlier, on February 5, 1973.
The anticipated 1940 Summer Olympics, officially known as the Games of the XII Olympiad and originally scheduled to be held from September 21 to October 6, 1940, in Tokyo, Japan, were cancelled due to the outbreak of World War II. Tokyo was stripped of its host status for the Games by the IOC after the renunciation by the Japanese of the IOC's Cairo Conference of 1938, due to the outbreak of the Second Sino-Japanese War. The government of Japan had abandoned its support for the 1940 Games in July 1938. The IOC then awarded the Games to Helsinki, Finland, the runner-up in the original bidding process. The Games were then scheduled to be staged from July 20 to August 4, 1940. The Olympic Games were suspended indefinitely following the outbreak of World War II and did not resume until the London Games of 1948.
The games were cancelled due to the onset of World War II. Sapporo was selected to be the host of the fifth edition Winter Olympics scheduled February 3-12, 1940, but Japan gave the Games back to the IOC in July 1938, after the outbreak of the Second Sino-Japanese War in 1937. Sapporo subsequently hosted the 1972 Winter Olympics.
The IOC then decided to give the Winter Olympics to St Moritz, Switzerland, which had hosted in 1928. Due to controversies between the Swiss organizing team and the IOC, the Games were withdrawn again.
In the spring of 1939, the IOC gave the 1940 Winter Olympics, now scheduled for February 2-11, to Garmisch-Partenkirchen, Germany, where the previous 1936 games had been held. Three months later Germany invaded Poland on September 1 to ignite World War II, and the Winter Games were cancelled in November. Likewise, the 1944 games, awarded in 1939 to Cortina d'Ampezzo, Italy, were cancelled in 1941.
The IOC would select an alternate host site, probably at a site that had hosted recently to ensure that the requisite facilities would be in place. Innsbruck had hosted the 1964 Games, and were thus chosen as the alternate host.