Tehran erupted into wild scenes of joy today once it became clear that Shah Mohammad Reza Pahlavi had indeed left the country.

Girls tossed flowers from upper floors. Civilians embraced soldiers and put carnations in their gun barrels. Statues of the shah and his father were torn down.

People danced in the streets. Motorists honked horns, turned on headlights, even set their windshield wipers in motion as signs of joy, while passengers leaned out doors, screamed their happiness and flashed the V for victory sign.

The uncertainties that lie ahead for this nation in revolutionary midstream were clearly visible. But such have been the tensions of the year-long struggle to oust the shah that Iranians appear determined to savor what could turn out to be one of their last days of such broad unity.

A long-repressed people, iranians did their best today to appear a smiling, Laughing and good-natured lot -- even with Americans, whose country is being blamed for Iran's ills now that the shah has gone.

"Shah gone," announced enormous 120-point type headlines in the evening newspaper Ettalaat. It front page featured a photograph of the shah waving farewell as he was about to enter the airliner he flew to Egypt.

The now familiar "death to the shah" chanted by crowds throughout the long struggle began to give way today to "after the shah, now the Americans."

A freshly painted sign said, "Yankees go home now, the shah is dead."

Foreign correspondents reported receiving anonymous telephone calls announcing, "The shah is gone; now you leave." But Iranians were friendly when they met Americans in Tehran.

"I'm sorry for the people of your country," a young man said, after castigating only recently reversed American government support for the shah, "because the shah is going to your country and he'll make things dirty for you."

A cartoon displayed by passengers in a honking car showed President Carter standing next to a shah whose neck was in a noose. The caption said: "Bye, bye."

Other signs of disrespect of the much-hated but once-feared monarch included drawings showing him dressed as a jailbird or a sexy woman, or in a uniform festooned variously with the Nazi swastika, the letters U.S.A. and the Star of David.

The United States and Israel, close allies of the shah, long have been singled out as enemies of the revolution led by the Moslem clergy.

The day's favorite trick was cutting the shah's bust out of banknotes. Most of the banknotes thus sacrificed were of small denominations, but at least one man thought nothing of cutting up a 1,000-rial note, worth $14.

Word of the royal couple's departure was broadcast on the 2 p.m. radio news, more than half an hour after the airplane had taken off. It caught many Iranians at the lunch table, but within minutes of the broadcast the first car horns were blaring in a pattern that went on well into the night.

With the shah gone, prudence became the order of the day for foreigners. At the Intercontinental Hotel, a 51 percent government-owned establishment favored by the foreign press, the management turned large lobby paintings of the shah and the empress to the wall.

By way of contrast, booksellers near Tehran University, displayed Marxist literature that only recently has been sold openly, and also the banned novel "Crash of '79" in Persian, which has been on sale for only the past two days.

The title was accurate enough, even if the novel presents the shah as a power-mad maniac who destroys himself and his regime in nuclear war with Saudi Arabia.

About a half-mile away, Iranians clambered up two floors to remove and drop to the street below a commercial neon sign of a crown. One of the many groups of demonstrators in the capital's streets clearly was disappointed that the shah had been allowed to escape.

"We wanted to hang him for all the evil he has done," a young man said.

Elsewhere, a dog wandered with the following sign on his back: "Fellow countrymen, my traitor brother has just escaped. Please arrest and punish him."

At Tehran University, which has become the focal pointfor all shades of opposition thinking since Prime Minister Shahpour Bakhtiar ordered troops away from the campus last week, a young lawyer said: "The departure announcement said he was going on vacation. Let me correct that. He has left forever, and we will never let him back, even if we have to fight to the death."

A few yards away, a happy crowd carried a turbaned mullah, a Moslem clergyman, on their shoulders before listening to him preach.

"Tonight we are going to have a big party with dancing and laughing and drinking -- yes, even beer -- to celebrate," a bearded young man said. "SAVAK (the secret police) and the CIA are finished, and I am 100 percent happy."

Were any reason needed to explain why Iranians so deeply hate SAVAK and the CIA, which helped set up its Iranian counterpart in the late 1950s, they were supplied by a man in his 30s. He took off his right shoe and sock and, holding his naked right foot in his hand, dispiayed a large scar on the instep which he said was the result of SAVAK torture.

If Iranians seemed united in their condemnation of the past, no such unanimity existed about their views of the future. A foreign journalist listening to a man talk about politics had his sleeve plucked by a third person who said, "Don't listen to him. Don't write a thing. He is a communist."

Time and again Iranians insisted, "We are Moslems -- not communists." This is to disprove the shahhs propaganda saying all the opposition is made up of what he called "Islamic Marxists."

Nor could Iranians agree whether the Bakhtiar government should be given a chance or rather swept away as Ayatollah Ruhollah Khomeini, the Paris-based Mosiem opposition leader, would seem to favor.

"Bakhtiar is dead," a student said.

But a young engineering graduate argued, "His is a medium good government," as if to suggest the prime minister should be given at least a chance to get the country back to work after months of turmoil.

Another point of discord is between Khomeini partisans, who want to abolish the monarchy and establish an Islamic government, and the more layminded Iranians who want a more Western-style republic.

Many are sondering when Khomeini will return to Iran. Some people were convinced it would be Friday to lead a day of demonstrations which he has asked to be the biggest in a year already full of huge marches.

Others said they simply did not know when he would come.

A key factor in determining his return was spotlighted by an army lieutenant named Mohammed Bashir, a recent University of Illinois engineering graduate who is teaching English at a military school.

Dressed in civilian clothes, he confirmed reports that Khomeini's recent orders to move the army over to his side seemed to be working. If that indeed were the case, perhaps Iranians were justified in their faith in Khomeini's ability to curb the armed forces, the last bastion of resistance to his march to power.

Not all Iranians were pleased with the shah's departure. Those chagrined varied from weeping women in government offices to hotel chambermaids fearful of the future without the shah, who for so long has symbolized unquestioned authority.

Abdel Karim Lahidji, a leading lawyer in the anti-shah opposition and a founding member fo the Human Rights Committee, said, "When I finally heard the news on the radio, I said to myself that after 25 years of dictatorship, what a chance for democracy and freedom.

"I'm waiting for tomorrow," he said, "when the real struggle starts for democracy -- tolerance for ourselves, prevention of anarchy, the start of a democratic life under the rule of law."