The longest hostage siege of the 20th Century was concluded this morning with the release by Iran of 52 Americans who were flown to freedom after 444 days of captivity.

They were put aboard an Algerian Airlines Boeing 727 aircraft and lifted off from Tehran's Mehrabad Airport. Their initial destination was believed to be Algiers.

Thus ended a nightmare that had preoccupied the international community and had threatened world peace since Nov. 4, 1979, when an armed mob seized the American embassy in Tehran with the complicity of the Iranian government.

The timing of today's events in the hostage saga was poetic, almost melodramatic. The hostages came out with only hours remaining in Jimmy Carter's term as president. Ronald Reagan replaced him at noon today.

But Carter finally had the triumph he had desperately sought for 14 1/2 months.

The flight from Tehran to Algiers was expected to take seven hours, with a possible refueling stop in Ankara, Turkey. In Algiers, the 50 men and two women were to be transferred to U.S. Air Force hospital planes for the second leg of their journey, to a military hospital in Weisbaden, West Germany. They will remain there for perhaps a week for medical examinations and a period of "decompression." Carter will meet them in Weisbaden -- probably tomorrow -- as a special emissary of the new president.

He went sleepless last night in the Oval Office as negotiations to resolve a last-minute impediment to the hostage agreement proceeded at an agonizingly slow pace. He had believed and had informed the American people before dawn on Monday that a deal had been struck with Iran and that the hostages would be freed within hours.

But Iranian officials balked at some of the language spelling out how part of their frozen assets would be returned to them. The problem was solved to the Iranians' satisfaction at 3:16 a.m. today, and three hours later about $6 billion had been deposited in an escrow account at the Bank of England in London.

"This step," said presidential press secretary Jody Powell, "completely fulfills all steps agreed to by the United States prior to the release of the hostages."

Powell's announcement came at the end of Carter's final day of anguish over the hostage issue. Yesterday's hangup had crushed Carter's hope that he could greet the hostages in Weisbaden and still return to Washington in time for today's inaugural ceremonies.

The hitch left the hostages in a new sort of limbo -- imprisoned somewhere in Iran for the 444th day since an armed Iranian mob seized the American Embassy in Tehran with the complicity of the Iranian government. And it left their families back home in America with a renewed sense of anguish and fear.

Iran had announced that the agreement would result in the prompt release of the hostages. Indeed, the chief Iranian negotiator boasted that "we have managed to rub the nose of the world's biggest superpower in the dust."

And Carter, in his pre-dawn statement, said, "We have now reached an agreement with Iran which will result, I believe, in the freedom of our American hostages. The last documents have now been signed in Algiers, following the signing of the documents in Iran which will result in this agreement."

The president even drank a champagne toast to mark the end of one of the most frustrating and humiliating episodes in American history. It was the episode that some believe wrecked Carter's career and led to the election of Ronald Reagan, who becomes president at noon today.

The president's statement created a sense of euphoria among the hostage families and among ordinary citizens as well. New York planned a ticker-tape parade. Congratulatory messages poured in from world leaders and politicians of both parties on Capitol Hill.

Iran seemed to want an end to the affair, too. Several explanations were offered, including financial and economic distress in the country, isolation from much of the world and Reagan's imminent takeover of the White House. As the chief Iranian negotiator put it: "We had no interest in continuing negotiation with someone who called the Iranians barbarians."

Reagan used that term last week. Moreover, his incoming defense secretary, Caspar Weinberger, said yesterday the new administration should establish a policy that would make it clear that there would be very "severe ultimate reprisals by the United States should anything of this kind happen [again]."

In any case, Algerian doctors were brought in to examine the hostages. They pronounced them in good health. Two Algerian 727s arrived at Mehrabad Airport in Tehran, stocked with fruit and sandwiches. They were prepared to fly the hostages to Algiers, where they would be transferred to Air Force hospital planes for the flight to Wiesbaden.

But, as the day wore on and the airplanes did not take off from Tehran, it became obvious that some hitch had developed. Carter canceled his flight to Germany. President-elect Reagan then asked Carter to welcome the hostages whenever they arrive in Wiesbaden. Carter agreed.

For the hostage families, another cruel ride on the emotional roller coaster began. From jubilation at dawn, the mood shifted quickly. Euphoria gave way to apprehension. By day's end, Harry Metrinko, whose son, Michael, is a hostage, said he was "just struggling along."

David Engleman, brother of a hostage, said, "I'm running on expectancy now. . . I don't feel too drawn out. I'm sure when we get the word the hostages are on the plane and out of Iran I'll be able to breathe easier."

The weekend agreements involved a pledge by the United States to never again intervene, politically or militarily, in Iran's internal affairs and a further pledge to release about $8 billion in frozen Iranian assets as soon as the hostages were airlifted out of Iran.

The snag that developed involved an 11-page appendix to the weekend agreements, a document delivered to the Iranians yesterday. The official Iranian news agency, Pars, said the appendix would "make it binding on Iran to drop any further claims beyond the approximately $8 billion which are to be escrowed in the British central bank [The Bank of England]." The agency quoted the Iranian minister of state, Behzad Nabavi, as saying that the appendix had no place in the agreement and that it represented "an underhanded maneuver for delaying the final solution of the problem."

Iran, he said, "severely condemned this subterfuge by the U.S. banks and wishes to open the minds of the world people and especially the minds of the American public to this fact."

He also said, however, that negotiations were continuing in Algiers between the U.S. and Algerian mediators who, he said, "fully supported Iran's stand on the issue."

Another explanation for the failure to release the hostages was given in a Tehran radio commentary which claimed that the Americans were being held to deprive Carter of the opportunity to greet them as his last official act before Reagan's inauguration.

"I can't tell you if it's deliberate," Carter's press secretary, Jody Powell, said yesterday. "It was hard to tell what was deliberate and what was not with them all along." Powell also warned that if the agreement were not completed in every respect by noon today, Reagan would not be bound by it. The new president, he said, would be free to act as he chooses.

Earlier yesterday, the political community in Washington was generous in its praise of Carter's efforts. "The nation owes him its collective thanks," said Rep. Clement J. Zablocki (D-Wis.), chairman of the House Foreign Affairs Committee.

Sen. Paul Laxalt, a Nevada Republican and one of Reagan's closest allies, said Carter had achieved a "beautiful result." Republican Sen. Charles Percy of Illinois, chairman of the Foreign Relations Committee, said, "I think it would have been a tragedy if he had left office without it being resolved -- a personal tragedy and a national tragedy . . . . It would have been the single greatest symbol of American failure. Having resolved it, we're all gratified."

Reagan himself blessed Carter's efforts yesterday morning but said he still had his fingers crossed in anticipation of the final outcome.

Senate Majority Leader Howard H. Baker Jr. of Tennessee called yesterday for a thorough review of the incident, to help develop U.S. policiies to protect the nation's diplomats and prevent a recurrence of the crisis. But, he said, "I do not foresee or wish to see" an inquiry into the seizure of the hostages in Iran.

In his statement two hours before sunrise, in Washington yesterday, Carter said the agreement with the Iranians provided that "following the release of our hostages . . . we will unfreeze and transfer to the Iranians a major part of the assets [about $6 billion] which were frozen by me when the Iranians seized our embassy compound and took our hostages. We have also reached complete agreement on the arbitration procedures between ourselves and iran, with the help of the Algerians, which will resolve the claims that exist between residents of our nation and Iran, and vice versa."

These claims will be decided by an International Arbitral Tribunal. It will consist of at least nine members -- three selected by the United States, three by Iran and the remaining three jointly selected by the two countries.

The prolonged and tedious negotiations had their beginning on Nov. 2 when the Iranian parliament laid down four conditions for a settlement. Carter replied that the conditions appeared to offer a "positive basis" for an agreement. Weeks of haggling followed with the government of Algeria acting as a mediator and go-between.

At one point the Iranians demanded payment of $24 billion but this was scaled down to the figure finally agreed upon yesterday. The chief American negotiator, Deputy Secretary of State Warren Christopher, put his initials on the agreement at about 3:15 a.m. in Algiers. "At last I can smile," he said.

Under the terms of the agreement, the money involved in the settlement was to be transferred by the United States to the Bank of England shortly after the hostages left Tehran.

The Carter administration emphasized that no ransom was being paid to Iran. As Vice President Mondale put it, "not a dime of American money" was involved. The entire sum came from Iranian assets that Carter had impounded after the hostages were taken.

He and Christopher expressed gratitude to the Algerians for their role in the settlement. "The American people," said Christopher, "will always remember this contribution to humanitarian matters by the Algerian people and their leaders."

The Algerian assistance was not confined to the negotiating process. An Algerian medical team flew to Tehran last week and examined all of the hostages before they were set to depart on Algerian aircraft.

The youngest of them is a 20-year-old Marine, Kevin Hermening of Cudahy, Wis. The oldest is Robert Ode, 64, of Sun City West, Ariz. All but two of the hostages are in government service, either as diplomatic employes or as military personnel.

When the embassy was overrun 14 1/2 months ago, nearly 100 hostages were seized, including foreign citizens working at the American embassy. Within a few days, however, the Iranians released most of the women and black hostages. Later, six other Americans were smuggled out of the country by Canadian diplomatic personnel. Still later another hostage -- Richard Queen -- was released after becoming seriously ill.

For the 52 who remained, there were days of despair. Their own government seemed impotent. Negotiating proposals repeatedly were rejected by the Iranians. A clandestine military rescue attempt ended in disaster and the loss of eight American lives last April. United Nations resolutions and rulings by international courts were ignored by Iran.

The political chaos inside that country further complicated the situation. It was never clear who was in control of the Iranian government or who was capable of speaking in its behalf.

In the United States, these events created shifting emotions and attitudes. The initial reaction to the hostage-taking was anger. There was cries for revenge, including military action. In some cities Iranian nationals were physically assaulted. Popular songs were written, expressing the national sense of outrage.

Other emotions were at work, too. Some Americans expressed guilt at past U.S. policies in Iran, especially those policies of support for the late Shah Mohammad Reza Pahlavi, who was overthrown in January 1979. They expressed sympathy for the Iranian revolution and called for understanding and patience, rather than retaliation.

That was the course Carter followed for five months. Then, frustrated and despairing of a negotiated settlement, he ordered a rescue effort by a small force of American troops. They landed secretly in an Iranian desert but soon aborted their mission because of aircraft failures and a disastrous accident that claimed the lives of eight men.

The political impact of all this on Carter's fortunes was mixed. Initially, the public rallied to his support and the crisis undoubtedly contributed to his renomination. But his failure to secure the hostages' release just before the election was, in the opinion of his own political advisers, a major factor in his loss of the presidency.

The long-term effect of the Iranian episode is yet to be seen, but it already has contributed to a more militant American foreign policy posture and to a growing willingness in the country to greatly increase military spending.

For the hostage families, the ultimate effect of this experience on their lives is also to be seen. But their immediate reactions to the presumed settlement were predictable.

Dorothea Morefield, wife of one of the captives wept. "It's over. It's over. It's finally over," she said.

Elisa Moeller, wife of Marine Staff Sgt. Michael Moeller, said, "I really think they're going to be fine. People that were strong when they went in are going to be strong when they come out. On the Christmas tapes, Michael was still his cyncial little self. . . . He's still got his dry sense of humor."

Louisa Kennedy, a prominent figure among the relatives of the hostages, said her "greatest consideration at the moment is what I will say to my husband. I have made up several dialogues in my head overnight. And I sincerely doubt that any of them will be the one that takes place. . . . It's going to be such an emotional moment. I hope he'll find the words first because I may not be able to."