reagan had nothing to do with it though.
"The hostages were held for 444 days. During that period, the Carter administration tried to secure their release through a military operation, which failed catastrophically, and then through a series of secret negotiations.
The negotiations were protracted and very messy, largely because of tensions between Iran's hard-liners and more moderate factions within their government. On several occasions, the Carter administration believed it had reached a final agreement, only to see the deal scuttled at the last minute by Iranian leader Ayatollah Ruhollah Khomeini.
But Carter and his negotiators kept working through the very end of his presidency, and eventually, at the last possible moment, they succeeded.
On January 19, 1981, the US and Iran signed the Algiers Accords, an agreement brokered by the Algerian government that secured the hostages' release in exchange for concessions by the US, including sanctions relief, the release of frozen Iranian assets, and the creation of the Iran–United States Claims Tribunal that would remove cases against Iran from US courts.
The hostages were released the following day, January 20, 1981 — the day Reagan was inaugurated."
https://www.vox.com/2016/1/25/10826056/reagan-iran-hostage-negotiation