It was past midnight -- the early morning hours of the last day of the Democratic convention -- when Robert Shrum bolted from Sen. Kennedy's Waldorf Astoria suite and raced to a party at the U.N. Plaza Hotel in his honor. Kennedy's chief speechwriter was nearly five hours late.

For days, Shrum, 37, had left a trail of broken appointments with press and pals, but he was generally forgiven as they watched him careening around the convention. He was getting nearly as many kudos for the senator's speech as was Kennedy. Shrum savored the laudatory headlines like an actor reading boffo reviews.

Nothing else had inspired that raucous, discordant, milling mob. But Tuesday night, Madison Square Garden was awesomely stilled. Some Carter delegates joined the Kennedy stalwarts in wiping away tears as the senator, eloquently redefining the liberal message, ended with, "The work goes on, the cause endures, the hope still lives -- and the dreams shall never die."

And there was Shrum, on the podium, crouched out of TV sight behind the senator, mouthing every well-known sentence, ready to bail out the senator if the TelePrompTer broke.

"We didn't get too nervous," he says archly as he recounts the story at his party of the man who ran the TelePrompTer. "He said the last time he did it was in 1964! I asked him why and he said his services had not been in too much demand since the time he took a coffee break in the middle of a Chuck Percy speech and the TelePrompTer broke." There is much laughter as Shrum imitates a politician suddenly struck dumb in the middle of "and I say to you . . . "

Shrum was winding down, cooling off, but not disheartened in the final days. He fought to the very end, composing "attack" versions of the senator's response to President Carter's vague acceptances of his platform to President Carter's vague acceptances of his platform planks. But now the word was "unity," and harmony -- of sort -- descended on the podium at 11:30 last night when Kennedy joined Carter. As the big, beefy senator moved in front of the cameras, he clearly upstaged the president with his five-minute presence, a set fighting-Irish expression on his face, tepidly patting the president once on the back, but stopping far short of the traditional upraised hand-holding. One TV shot of the president caught a thinly veiled glare.

Shrum, like many other senior Kennedy aides, was enjoying the spectacle. They clung to Kennedy's speech, which far overshadowed the president's uninspiring performance, as a statement for the future, not a eulogy to the past. "Carter won the nomination," shrugs Shrum, "but Kennedy won the heart of the Democratic Party."

There is a general feeling after all these months that the campaign often marked by chaos and confusion and ill-defined reasons for running had ended in a redemptive, class-act finale that will lead once again to running in 1984.

As one said, "Ted Kennedy irrevocably established a character. In people's eyes, he is persistent, stands for a great deal, is not a dilettante any longer. The 'fat rich kid' has shed some of the fat."

Some of the Kennedy staff face uncertain futures, others return to the Senate staff or their previous jobs.

Larry Windsor, a Miami lawyer who spent 10 months slogging across the country seeing to the media needs says he hopes to move to Washington. "How much longer can it be until there's another draft movement?" he says wistfully."I just have to survive for 18 months."

The staff members are, for the most part, believers -- either blindly loyal to Kennedy or committed to the causes he espouses. They gulp hard and many say privately that rather than vote for Carter they will write in Ted Kennedy in November. Even tough political tacticians like Carl Wagner, who left his union activities for the campaign, came because of a commitment to working-class concerns. And Shrum, who never worked for the senator before, will join his Senate staff.

"We're permanently involved in losing liberal causes," says John Gage with a laugh, "which indicates some ideological constancy." Gage was a Bobby Kennedy delegate to the memorable 1968 Chicago convention and a McGovern man in '72, along with Shrum and delegate headhunter Rick Stearns. There are of course the ubiquitous longtime Kennedy family members and friends. And then there are the very special true-blue believers like Melody Miller.

A strikingly pretty, red-haired woman, Melody Miller sits quietly watching every second of the nominating rollcall Wednesday night in as lonely, cavernous ballroom. A handful of remaining aides, volunteers and press watch the inevitable Carter victory amid packed boxes. A volunteer with a huge orange "Dump Carter" button answers the phone. The inevitable suddenly becomes an emotional moment as delegates in state after state remained with the senator and fervently shouted their pledge to him even though he had withdrawn two nights earlier.

When South Dakota cast its vote for "the next president in 1984" the screen flashed to a stonefaced Rosalynn Carter. The room of Kennedy supporters howled with laughter as Walter Cronkite said, "I don't think Mrs. Carter is entirely happy."

But for all the joking, it was the end of the Kennedy 1980 dream. Melody Miller brushed away a tear.

"I was going to be a gym teacher. When John Kennedy came along, I was 16," said Miller, who grew up in Arlington, close enough to get Potomac fever early in life. "I use to skip school, I wouldn't miss a Jack Kennedy press conference. I will never forget when someone asked him to define happiness and he said it was 'the fullest use of one's powers.'" Miller remembers that as the golden era; the Peace Corps, the idea that one person could make a difference, the "ask not what your country can do for you but what you can do for your country" days. "My idealism and optimism were set in cement."

Then began a long trail of devotion to the Kennedys.

She worked first as a volunteer for Jack Kennedy and then worked on Jackie's staff in 1964. She remembers the exact number of minutes -- 22 -- of the standing ovation Robert Kennedy got at the 1964 convention when he introduced a film about John Kennedy. She then worked for Robert Kennedy after graduating from Penn State University and worked on his 1968 campaign. She says softly, "That was so short a time." A press aide at the time, Miller packed up the press office and then the senator's office after he was killed. "It was a real wrench to watch his chair and desk being removed. I turned out the lights and closed the door; I was the last one in the office. I took one month to let my nerve endings heal and then went to work for Edward Kennedy."

Miller handled legislation on the Senate floor, worked on special family projects and in the press area and describes herself as a "utility infielder."

Miller dismisses those who say that the Kennedys are demanding and demeaning to their staff. "Loyalty is a two-way street with them. They come to our hospital beds, our weddings, open their homes and swimming pools to staff use." Married for five years, Miller, 35, is now divorced and thinks that she might "someday get married again and have some children -- and bring them up on Kennedy books. If any of the Kennedy children run for office, they can count on me to stand on a street corner and hand out pamphlets for them."

No words of criticism pass Miller's lips. She intends to start packing up the headquarters office in Washington today, will take two weeks off and then return to the Senate.

"I don't think Edward Kennedy has really lost -- he's won more than he's lost. The question of 'whether' he should run was so all-consuming. For him to announce was to risk his life. That he survived was all the victory I ever wanted."

Not all staffers are as serenely possessed with Kennedy clannishness. There was infighting, particularly in the press division, quarrels about now the campaign should have been run, a general feeling that director Stephen Smith had goofed several times.

"A major weakness was Kennedy's loyalty to subordinates. People who didn't do a good job weren't asked to leave," said one. "Some, in fact, were downright disasters."

One aide, not one who possesses blind loyalty, complained that the campaign had been marked by a "personal arrogance" and an inability to make decisions about the staff. "Now if we can get just a little more of the kid gone, he'll be a perfect candidate. Whenever I felt like leaving in that atmosphere of arrogance and personal indifference, my feelings were tempered with the knowledge that there was a general caring and compassion. Unlike Carter, Kennedy's commitment to issues, I think, is even beyond most people's comprehension."

But the overriding theme is that liberalism is not dead; that these are hard times but politics is cyclical and liberal candidates will prevail once again in the future despite defections from the old liberal coalition. "It is a cliche to say that Kennedy is a relic of the past," spits out Shrum. Friends of Shrum's joke that he's had so many losers that he wouldn't know what to do with a winner. They include Lindsay and McGovern. Shrum worked for Carter for all of nine days in 1976 and then quit, accusing Carter of "manipulation and deception." He fired off a letter to the president that said, "I am not sure what you truly believe in -- other than yourself." These days Shrum smilingly says he doesn't want to talk about it in the "spirit of unity."

The staff and the rumor-chasing press had to deal with each other at the convention. The reporters and cameramen lurked and staked out their posts down the 16th-floor hall from the rooms of senior aides and the senator. On Wednesday, around midnight, the tedium bordered on insanity as they tried to find out desperately what Kennedy's response to Carter's acceptance statement of the platform would be and -- more important -- when it would be. John Podesta, an aide, walks down the hall and throws up his hands at the onslaught from the Lurk Patrol. "I don't know anything . . . but I'll let you speak to a man who just came from the senator's suite." He points down the hall to a waiter trundling out with an empty table. A camera crew, in what-the-hell desperation, turns on the lights and films him.

At one point another aide was attempting to feed the media beast the senator's telegrams. The reporters sat on the floor by the elevators sifting through them. Not one asked the senator to embrace the president. "We really don't want you standing beside Carter Thursday -- it would be too degrading to you. If you must -- please, no hugs for Carter," wrote one couple. "Hang tough, tell Powell, Strauss, Jordan, Carter to shove it," came from San Francisco. And the favorite of the press, from Ashtabula, Ohio: "He said he would whip your ass. Now please don't kiss his."

Press aide Dick Drayne made periodic visitations and said so little that the sessions got to be a joke. "The answer is 3:45 p.m. -- now what is the question?" he quipped.

Drayne was one of those Senate aides who drifted away like Paul Kirk, lawyer and a chief campaign strategist who returned after years in private life. And then there are those who stayed, like soft-spoken Carey Parker, the encyclopedic issues man who has been with Kennedy in the Senate for a decade.

Drayne left Kennedy in '75 to become a political consultant but now seems uncertain of his future and will at least temporarily return to the Senate staff. He remembers, as a young journalist in Boston, being contacted to work on Kennedy's staff in 1965. "I would have spent the rest of my life wondering what would have happened if I hadn't. I never regretted it. We believed in the same things. The Kennedys stand for the right things as far as I'm concerned."

Drayne, an unflappable, chain-smoking press aide, laughs at the rumors of '84 already starting up since the speech. "I've lived with that since '68. Every time he makes a hell of a speech, everyone wants to know if he's running, what does it mean? I always say it means he doesn't like to give bad speeches in big halls. As he always says, he's learned as a Kennedy not to make long-range plans."

He muses about why he keeps coming back. "There's no question the Kennedys foster extraordinary loyalties, just as they foster hates."

One of the problems for Kennedy and his liberal litany is that the children of yesteday's "huddled masses" no longer automatically embrace them.

In a recent interview, Bill Moyers talked to Kennedy about expiation, about the thought that voters wanted to punish the senator, that he couldn't win without first atoning and that defeat was a form of expiation. It is a view that intellectuals like to expound since Chappaquiddick, and it is one that Kennedy cannot answer. But a maid in a New York hotel did not have to know the word to understand the idea. "It just not be his time," she said several times. "People just want to see him lose and then maybe they will forget it. That Chappa," she pauses, "I never could pronounce it, maybe that will go away enough by 1984."

The senator and his staff are not into psychoanalyzing the public these days. They are at home in Washington today, will have a little party for the Secret Service detailed to the heavy task of guarding a Kennedy. For the senator it will be on the Hyannis. The staff will go about the task of ripping out the support system for a campaign that was once so long ago thought to be invincible. The dormitory with its two dozen. Secret Servicemen will disappear from the McLean, Va., home. So will the press that tags his every move; no longer will there be the glaring light for every moment -- from a tennis game to a major economic policy speech. Tomorrow it will all be gone.

For now, it is over.