Speaking from Charlottesville, US celebrity billionaire and presidential hopeful Donald Trump lamented that US President Barack Obama «dealt from desperation» while drafting a final nuclear agreement with Iran in Vienna. Trump had it partially right, but he also had it partially wrong too. It was not that the Obama Administration was desperate per se as Trump lambasted. It is that the United States of America is in decline as the foremost power of the world, which is what forced the US government to sit at the negotiating table with the Iranian government.
Geopolitical, economic, and tactical conditions obliged the US to sit down with Iran. Washington was compelled to seek a deal with Iran by geostrategic circumstances. It is the same story with the Cubans. The decline of the United States and its increasing isolation in Latin America forced the Obama Administration to start talks with Havana and to reverse the decades-long hostile US policies on Cuba.
The Pathology of the Sanctions System against Iran
The sanctions system against Iran was not designed to bring Tehran to the negotiating table, as the Obama Administration misleadingly claims. This is US government revisionism and a political myth constructed to hide the pathology of the US-designed international sanctions system. The international sanctions system was designed to force Tehran to surrender and to submit to Washington’s edicts.
Sanctions were never needed to bring Iran to the negotiating table. Within the format of talks between Iran and the EU-3, the Iranians were even negotiating with the British, French, and Germans long before the sanctions system was established. The earlier nuclear negations between Tehran and the EU-3 failed in 2005 due to the obstructionist administration of George W. Bush Jr., which was more interested in a war with Iran or regime change in Tehran to bring about «the birth pangs of a ‘new Middle East.’» 
When Washington and its European Union partners realized that the sanctions would not make Iran surrender in 2013, they understood that they had run out of options. Economic sanctions could go no further and had reached their limits. Instead, the global environment and circumstances were increasingly beginning to change to the benefit of Iran.
With or without the removal of the sanctions system, Russia and China were getting ready to enhance trade. Moscow and Beijing already considered the unilateral the US and EU sanctions illegitimate. In parallel, the European Union’s need to economically re-engage Iran to counterbalance the sanctions/economic war against the Russians that emerged after EuroMaidan in Ukraine was increasing. The sanctions would have started to unravel and other countries would have eventually joined Russia and China in normalizing their trade with an economically resurgent Iran.
The Costs of War
The US had no reliable options left. Despite the hawkish «all options are on the table» rhetoric from the Washington Beltway, a war with Iran was understood to cost too much and to be far too risky. If the US could have militarily attacked Iran, it would have done it like it did to Afghanistan in 2001 and Iraq in 2003. This has been stated publicly by Iranian military commanders, which say that they know that Tehran was the main US target for the Bush II Administration.  Thus the Bush II slogan: «Anyone can go to Baghdad, but real men go to Tehran!»
Any attack on Iran would lead to a highly unpopular regional war in the Middle East that would have devastating political, social, economic, security, strategic, and diplomatic results for Washington. In one way or another, a war with Tehran would cripple the U.S. in the Middle East and demote it as a world power. U.S. war games simulating an invasion of Iran even assessed major losses for Washington. 
A June 2015 report published by the Center for Strategic and Budgetary Assessment even confirms this by saying that the US does not have the proper military arsenal for conventionally attacking Iran, because the Pentagon cannot launch a long-range assault.  According to the report, the Pentagon is primed for short-range direct strikes whereas the Iranians, like the Chinese and the Russians, have long-range defensive systems that prevent the US from getting close enough for an attack. 
Nor were and are there any guarantees that any possible war with Iran would not spill outside the borders of the Middle East and Central Asia or that such a conflict would not transform into a broader international war. In this context, Washington had no guarantees that the Russians and the Chinese would not intervene to help the Iranians against a US attack. Moreover, as the US and EU increasingly come into confrontation with Russia and the US increasingly comes into confrontation with the Chinese, Washington and its EU allies need rapprochement with Iran to reduce, at least temporarily, their hostilities on one front.
Tehran, Washington, and the Eurasian Century
If Beijing and Moscow totally annulled their partial commitments to the sanctions system, the US was uncertain if the corporations and governments of the EU and Asia-Pacific would have continued with the US-led sanctions system. The reaction of US allies after the Lausanne Agreement says a lot in this regard.
After the Lausanne Agreement, business leaders and trade officials from Asia, Europe, and the rest of the world began making trips to Iran in anticipation of the reopening of the larger Iranian market. Executives from the Anglo-Dutch energy giant Royal Dutch Shell and the Italian energy giant Eni even travelled to Tehran.  While European and Asian corporations were rushing to Iran prepare for the normalization of trade, the French ambassador to the US, Gerard Araud, told the hawks opposing a nuclear deal with Iran at the Atlantic Council think-tank to calm down about European businesses rushing to restart trade with Iran.  «Really, we lost a lot of money, not the Americans», he reminded the Atlantic Council. 
With the Russian and Chinese challenge being posed against the US dollar and Bretton Woods system with the creation of a rival financial global architecture with the BRICS News Development Bank (NDB) and China’s Asian Infrastructure Investment Bank (AIIB), it is clear that the financial and banking sanctions the US put into place would have also eroded away. As global circumstances changed and Eurasian integration accelerated, it was the US that wanted a final deal in Vienna more than Iran.