This had little to do with Jimmy Carter and more to do with the policies of the state.
Step-by-step explanation:
The state of Iran had recently turned into a Islamic one after the revolution and their basis as a nation had been the rule of their theological leader.
They had been wary of the US and did not want to risk a war but also did not want to be smothered by them.
So, the policy was to keep the hostages until a regime change for a proper deadlock between the two nations and avoid direct conflict
Once that was done the hostages were released.