As you mentioned in your question, Sochi 2014 is the most expensive games in Olympic history, surpassing Beijing 2008. This is even more incredible when you realize that the Summer Games has three times more events than the Winter Games, which means that Russia has spent almost 4 times more per event than China did in 2008.
When Russia was bidding for the Olympics, President Putin gave a speech to the International Olympic Committee promising to turn Sochi into a world-class resort. His original number of $12 Billion was much more than the other finalist nations were offering to spend. Now, however, as the games are about to begin, the total spent by Russia is being reported as $51 Billion.
Joshua Yaffa has written a fascinating article for Bloomberg Businessweek that outlines some of the reasons for the out-of-control costs in Sochi.
Among the reasons that he discusses:
Engineering problems: Sochi is in a narrow region between the Black Sea and the Caucasus Mountains. There isn't a lot of room for large arenas and venues. The best place to locate the Olympic venues is the Imereti Valley, an area that is prone to flooding. The area constructed around Olympic Park has had to be built and rebuilt a few times due to flooding and inadequate engineering. Also, in constructing the new railway between the Olympic Park and the Mountain venues, major tunneling was required.
Needed infrastructure: The Imereti Valley had very little infrastructure to begin with, and Russia has had to build roads, railroads, and utilities from scratch.
Corruption: The first two reasons are practical reasons for excessive costs, but the majority of the article gives example after example of corruption, both by government officials and by contractors. According to the author, this is a very significant reason for the out-of-control spending.