(This is mostly a repost of my answer to the now deleted question.)
Iranian President Rouhani is a moderate (by Iranian standards) who took a risk signing the Joint Comprehensive Plan of Action (JCPOA) with the US, the EU, and others. Let's look at some background on the deal first:
From the Iranian standpoint, the deal made sense because it provided economic relief. According to the Council on Foreign Relations:
The EU, United Nations, and United States all committed to lifting their nuclear-related sanctions on Iran. However, many other U.S. sanctions on Iran, some dating back to the 1979 hostage crisis, remained in effect. They cover matters such as Iran’s ballistic missile program, support for terrorist groups, and human rights abuses. Though the United States committed to lifting its sanctions on oil exports, it kept restrictions on financial transactions, which have deterred international trade with Iran.
In return for this, Iran committed to nuclear restrictions. Again from the Council on Foreign Relations:
The accord limits the numbers and types of centrifuges Iran can operate, the level of its enrichment, as well as the size of its stockpile of enriched uranium. (Mined uranium has less than 1 percent of the uranium-235 isotope used in fission reactions, and centrifuges increase that isotope’s concentration. Uranium enriched to 5 percent is used in nuclear power plants, and at 20 percent it can be used in research reactors or for medical purposes. High-enriched uranium, at some 90 percent, is used in nuclear weapons.)
This deal was risky for President Rouhani because he put Iran's ambitions as a regional power on hold for economic relief. Now that the US backed out of the deal, Iran misses out on years of enrichment and it doesn't have economic relief. Since then, elections in Iran took place which were won by a more conservative candidate. His views on reviving the nuclear deal, according to the BBC:
Mr Raisi said his approach to foreign policy would not be limited by the nuclear deal negotiated by Mr Rouhani, which saw Iran agree to limit its nuclear programme in return for sanctions relief.
On the Vienna talks, he said: "We will not allow negotiations to be for negotiations' sake. Negotiations should not be dragged out but each sitting should bear results. A result-oriented [negotiation] is important to us and it should have an outcome for the Iranian nation."
He likewise dismissed the possibility of any negotiations over Iran's ballistic missile programme and its regional policies, including its support of armed groups in several countries, despite calls by Western countries for them to be part of any new agreement reached in Vienna.
By exiting the JCPOA the deal is rendered ineffective and Iran took that as an opportunity to increase its enrichment activity. According to CBS News:
President Hassan Rouhani set a 60-day deadline for new terms to be reached by the nations still trying to keep the deal viable, and said if that didn't happen, Iran would resume enriching uranium to higher levels.
That's a totally expected outcome. There was a deal between Iran, the US, and other nations. The US exited the deal so that Iran would no longer benefit from some parts of the deal. As such, there is no reason for Iran keep its promises under that deal. It can now blame its breaches of the deal on the US because the US exited first.
As for calling Trump's decision a miserable failure, I would point to an opinion column on Politico. Specifically, the following paragraph sums it up:
Barring a miracle, Iran’s next president will be Ebrahim Raisi, the current head of the judiciary — a man with an atrocious human rights record, including a role in a 1988 campaign of summary executions. Raisi’s likely presidency also makes him the top candidate to replace 82-year old Ayatollah Ali Khamenei as the next Supreme Leader of Iran, to the disappointment of many who thought it would be Rouhani. This will have huge repercussions for Iran’s foreign policy, and its domestic policy, including human rights.
By taking a hard line with Iran, President Trump helped oust a Reformist in favor of a Principlist politician (both by Iranian standards). On the broader scale of things, that's not in the US interest. Instead of keeping Iran in a place where the international community could keep a lid on the situation (e.g. through the JCPOA) it pushed them away to a place where it is less likely that there will be cooperation and it's more likely that Iran will continue its nuclear proliferation at a higher pace.
Regarding the terms moderates and conservatives, Wikipedia draws a distinction between two political factions: the Iranian Principlists and the Iranian Reformists.
The Principlists, also interchangeably known as the Iranian Conservatives and formerly referred to as the Right or Right-wing, are one of two main political camps inside post-revolutionary Iran, the other being Reformists. The term hardliners that some western sources use in the Iranian political context usually refers to the faction, although the principlist camp also includes more centrist tendencies.
The Iranian reformists are a political faction in Iran. Iran's "reform era" is sometimes said to have lasted from 1997 to 2005—the length of President Mohammad Khatami's two terms in office. The Council for Coordinating the Reforms Front is the main umbrella organization and coalition within the movement; however, there are reformist groups not aligned with the council, such as the Reformists Front.
President Rouhani is indeed considered more of a reformist, according to Wikipedia
He was elected as president with heavy reformist support, and he pledged to follow through with reformist demands and to bridge divides between reformists and conservatives.
President-Elect Raisi is described as a principlist politician on his Wikipedia page.