There is a good chance that if the hostages had been released before election day that Carter would have won.
Hamilton Jordan, his chief of staff, wrote a book about Carter's last year in office. A lot of people thought Reagan was a clown. He was not as popular as his worshippers in the GOP like to think. Reagan was usually ahead of Carter in polls before the election, but usually by a few points, not the same margin as the final count.
The hostage crisis started on Nov 4, 1979; the one year anniversary of the hostages being taken was right on election day. A lot of media was running stories on the hostages in the week leading up to the election, particularly over the weekend. Jordan says there was a shift that took them all by surprise in its speed and magnitude. When you spend months only a point or two behind, it is easy to think you might win.