Robert Keith Gray was up at 5:45 the other morning, worrying. The specter of some 20,000 formally dressed inaugural ballgoers logjammed in traffic around three hotels was giving him nightmares. He hadn't gotten in until 3 a.m., having gone to Pennsylvania for a testimonial dinner for outgoing Sen. Richard Schweiker, and had dictated four messages to his secretary on a recording machine after that. But if there's one thing that stands out in the profile of Bob Gray's quarter-century of success in Washington, it's the adage, get up early and work late.

Gray, 55, who heads the Washington office of one of the world's largest public-relations firms, Hill and Knowlton, is co-chairman, along with California businessman Charles Z. Wick, of Ronald Reagan's inaugural committee. This is a job generally thought of as being a thankless task, one in which the possibilities of alienating people are endless. Everybody wants tickets, those who get tickets want more, high school bands and businessmen all want a piece of the action, and after Jan. 20 all you get is a letter from the president and a lot of bills.

"You can't make everyone happy," said Gray. "The demand is always greater than the supply. But a professional communicator ought to be able to make people understand that. We want to get the administation launched in a memorable way. It has political importance, of course. It's worth a lump or two -- which won't last. People forget."

Gray calls to his secretary, Marie Thessen, whom he brought with him from Hill and Knowlton. He asks her to find out if an upcoming dinner is black-tie, and to remind Wick's secretary that the two co-chairmen need to meet before they see the president-elect the next day. Gray is to have a drink with Walter Cronkite, before the dinner.

Bob Gray is a Washington fixture and a Washington phenomenon. And right now he is in an enviable position with the incoming administration. He supported Reagan in 1976 and last fall he joined the Reagan campaign as director of communications, coming in toward the end.

". . . six weeks before the campaign was over the Reagan campaign was chaos," said Sen. Laxalt, Reagan's campaign chairman, at a testimonial dinner for Gray last month. Gray set up an internal communications sytems, Laxalt said, and helped them win, "as much as anyone."

That same diligence has been in evidence since he came here looking for a job in the early '50s, and set about finding one in 60 days. He'd try to see people during the day, and write letters and thank-you notes at night. "If I found out during an interview that your hobby was butterflies, somehow I'd find something about butterflies, an article or card or whatever, to send you," he said. He got a job as a special assistant to the secretary of the Navy in 1954, and he was on his way, a small-town boy from Hastings, Neb., who would end up routinely inviting cabinet officers and senators over for dinner and riding around in a chauffeur-driven, telephone-equipped Cadillac. 'Get Me Walter Cronkite'

Gray hits the ground running. He has a habit of doing a sort of skip when he sets off, as though to gather momentum. He's short and slight, controlled, scudding down hallways like a determined sailboat.

On this day, he is wearing a blue wool suit, which by coincidence matches his typewriter and the plastic government-issue couches in his office at the inaugural committee. Behind his desk there are two flags, American and Nebraskan.

By 8:45 a.m. he has already been to a meeting at Hill and Knowlton, but he is late for an 8:30 meeting with Merrill Osmond, of singing brothers fame, William Critchfield, president of the Osmond Studios in Orem, Utah, and Tommy Walker, a producer. They are here to discuss a proposal for a program to open the four days of inaugural festivities. At 9:10, business concluded, he takes a phone call, one of as many as 850 calls the inaugural committee averages every day.

"Get me Walter Cronkite at the Madison," he tells his secretary. They arrange their drink. "Ciao," he says as he puts down the phone.

He chats with a Hill and Knowlton chauffeur who has been sick, and shows him the special inaugural No. 1 license plates to put on the car. He makes another phone call, discusses a speech he has to give the next day with his assistant, Chuck Crawford, and then goes into a meeting with Wick, parade chief Terry Chambers, and the other executive directors of the inaugural committee.

The committee decided to cut the inaugural parade to an hour this year, the better to attract television coverage. This means that only a relatively few bands can be in the parade: 19 high school bands, and 10 military units. This also means that all the bands that candidate Reagan casually invited to the inaugural parade in a burst of campaign generosity will have to be told to stay home.

The inaugural committee gets about 2,000 letters a day. Many of these are from people who want to be in the parade, go to a ball, see the parade, sell something to the committee, or volunteer their services in some way. Like the man who wanted to drop 5,000 inflatable plastic elephants out of an airplane, or the 48 "Dutch's Dollies," a "happy group of Iowa ladies," who want to come with their husbands and sit together, in costume, to watch the parade and wave to "Dutch" Reagan. Or the businessman who wanted 800 tickets.

The inaugural committee seems prefer it if most everyone would watch the festivities on television.

At 10 a.m. Gray walks from the conference room to his office next door to meet with a free-lance photographer about the possibility of setting up a picture-taking concession at the balls. She says she'll think about it. Nine minutes later Gary Hunt, a well-to-do young businessman from Los Angeles here to organize the nine inaugural balls, comes in for a confidential discussion. Hunt wears a beeper hooked into his belt and looks harried. How He Saved Saccharin

Bob Gray does not look harried. "Sometimes I think things here aren't fast-paced enough," he said at one point during the day.

The layers of his life and career fall neatly into a mille-feuille of friends, contacts, politics, and lobbying. When he goes to talk to a legislator, he knows who his constituents are, what influences him, everything about him he can know. "He knows everyone in town," said Liz Carpenter, who is now chief spokesperson at the Department of Education but worked for Gray at Hill and Knowlton. "And he's probably danced with his wife . . . He has a terrific capability for juggling lots of balls without letting any of them fall on his head. He delights in the high pressure of Washington."

"Good information, that's the key," said Steve Martindale, a lawyer (and like Carpenter, a Democrat) who worked for Gray for two years. "When he goes to see Senator X he knows from beginning to end what's going on. You know these guys don't vote for you on the basis of friendship. He's a classic Harvard Business School graduate -- nothing is ever good enough. If you came in with what you think is a pretty good memo, he'll always think of five things you've left out."

The "information" includes everything from commissioned surveys demonstrating public opinion supporting his client's position, to organized grass-roots support, to technical reports. Clients are coached on how to present testimony, and what it should contain, or taught how to come across well on television in a studio at Hill and Knowlton's office.

"Nobody's going to vote for my client because he likes me," said Gray.

When the Food and Drug Administration wanted to ban saccharin, Gray was hired by the soft-drink-industry-dominated Calorie Control Council, Michael R. Gordon wrote in an article in the National Journal last spring. mGray got together a coalition of diabetics, weight watchers and soft drink producers and so far the FDA has not imposed the ban. When Procter and Gamble invented "Pringles," a processed potato snack stacked in a tennis-ball type tube, Hill and Knowlton had to convince the FDA to let the product be labeled a potato chip. Crates of the things were delivered to offices on Capitol Hill, and to the National Press Club. The Potato Chip Institute, which did not want Pringles in its fraternity, lost.

It is of such victories as a multimillion-dollar public-relations firm is made.

"Actually, the new administration will probably be bad for my business," Gray said, smiling. "An anti-business government produces a lot more clients needing to fight regulations or legislation." Dash Without Flash

At 10:20 Gray tells Marie Thessen to call Mrs. Caspar Weinberger and leave a message about a party. A military aide comes in to tell him she's arranged to have the speed limit signs in the parking lot changed from 10 to 20 miles per hour, and asks him to choose which ones he'd like on the office walls. Gray changes an 11 a.m. meeting at the Capitol to 11:30, and asks for a note on what's supposed to happen at lunch with Sen. Paul Laxalt (R-Nev.).

Then Gray spends a few minutes with Thessen ordering Christmas presents for his mother, brother and two sisters. During this one day, he will order a gift for Wick and his wife, and another to present to Schweiker at a dinner Gray is giving for him Monday at Decatur House.

Gray excels in these personal details. It is the one thing that everyone who knows him mentions. The handwritten thank-you notes, the birthdays and anniversarys remembered, the small attentions and considerations.

Carpenter remembers her first important client meeting as the first woman vice president in the Washington office of Hill and Knowlton.

"As we began a man appeared with a big silver tray of tea and coffee.I was the only woman in the room and I could see the man hesitate and start to bring it over to me. Well Bob jumped right up and told him to bring the tray to him, so that I wouldn't be pouring the coffee. He's very sensitive that way."

She and others believe that these attentions are not artificial. "He is a real friend," said Carpenter. "If some senator gets divorced and his wife is on the phone needing a job, he'll get out there and try to find her a job. . . He has good Midwestern values," she added, "other than being a Republican."

At 10:35 he meets with Jackie Pressler of the Teamsters Union. Pressler wants more tickets. The Teamster endorsed Reagan, and have loaned several people to work on the inaugural committee.

Pressler leaves after 10 minutes and Gray calls a woman in New York to try to persuade her to chair one of the inaugural balls.

The uninitiated might expect a professional public-relations man to be smarmy, oozing flattery and cheerfulness. But Gray talks, as he walks, quite quickly, asking without begging, quickly offering the woman a way out (an honorary chair) when he senses she might not do it. She says she'll think about it.

Gray's style is strictly middle American, middle class, meat and potatoes, dash without flash. He drives a Fleetwood, not a Mercedes, and he lives in Arlington, not Georgetown. His white hair never moves, but it doesn't look sprayed. Although he has a beach house in Rehoboth that one neighbor describes as looking like "an A-frame made into a pagoda," his public style is unflamboyant.

At 11, he heads for his car, accompanied by George Kersey, an Army colonel detailed to the committee, and followed by Wick and his wife in another limousine.Gray's driver, a young airman who usually drives a bus for the Air Force, does not know where the Cannon House Office Building is.

As soon as Gray gets in the car, the phone rings. Once that conversation is over, he makes two more calls as the big black car cruises through the desolate housing projects of Southwest on its way to the U.S. Capitol.

He dashes out of the car at the Cannon Office Building, and trots upstairs to where freshmen Republican congressmen are meeting in an orientation session. He and Wick are supposed to give them a presentation on the inaugural plans, but are kept waiting in the hall for 20 minutes. When they finally get in, Gray stays about seven minutes before tearing off to another meeting in the Capitol. While the car drives to the Capitol, a distance of about three city blocks, he calls Marie Thessen and tells her about the glitch in the schedule.

At the Capitol he listens to a presentation by Robert Jani, who stages productions for Radio City Music Hall, on the fireworks program that will close the inaugural festivities the night of Jan. 20. Gray leaves lugging a 4-foot-long framed photograph of fireworks that Jani pressed on him. l

After lunch with Laxalt and the Wicks, Gray is back at inaugural headquarters for a 1:30 meeting to discuss the ball-traffic jam dilemma. It is not resolved. At 3:12 he comes back into his office and asks Thessen, "calls quickly," and starts working at returning phone calls.

Later he is driven over to the National Museum of Natural History to show it to Mrs. Wick; then he goes on to Hill and Knowlton for a fast half-hour of signing papers and discussing clients. On the way to Hill and Knowlton, he calls Thessen and asks her to get Clare Boothe Luce's home number in Honolulu; she calls back with it a few minutes later.

Gray's had one embarrassing moment during his chairmanship, not counting a press conference last week when reporters giggled as Wick, reading a list of the entertainment at the inaugural-eve gala, came to "and General Omar Bradley will do a moving vignette with Jimmy Stewart." He announced there would be no guns in the parade, only flags, and had to retract the plan after being told that flags in such numbers could get tangled and snap back into someone's eye. And that such a non-military image was not quite what Reagan advisors had in mind.

"For a professional communicator, he sometimes gets carried away," said one assistant.

There have been other awkward times. He helped a Korean businessman named Tongsun Park found the George Town Club in 1967. Ten years later Park was the help of the Korean CIA as a device for wining and dining politicians in an illegal effort to influence them. The charges were later dropped when Park agreed to cooperate with the Koreagate investigations.

In 1974 Gray was questioned by Senate Watergate Committee lawyers looking into the question of large contributors to Richard Nixon's campaign being promised ambassadorships, according to an article in Washingtonian magazine. Neither of the contributors Gray was questioned about received ambassadorship. The Climb to the Top

The important thing is that over a period of 25 years Gray has become part of Washington, of its public social life, of the political inner circle, and the Capitol Hill machinery that grinds out legislation oiled or altered by lobbyists like he. He has remained unmarried; a perennial escort of Rose Mary Woods, Richard Nixon's former secretary; the useful extra man at dinner parties.

Gray came to Washington with an M.B.A. from Harvard, some teaching and business experience. He was in the Navy during World War II and is still a commander in the Naval Reserve. He was one of four children of an engineer who designed agricultural products like feed grinders.

While he was working at his first Washington job, with the secretary of the Navy, Eisenhower presidential assistant Sherman Adams heard him give some testimony at a Congressional hearing. Adams invited him to work at the White House, dispensing patronage jobs. He replaced a man who'd had a nervous breakdown. When the man recovered, Gray found him a patronage job and stayed on at the White House. He was later Eisenhower's appointments secretary and later secretary of the cabinet.

In 1960 he joined Hill and Knowlton, registered as a lobbyist, and began developing the specialty that has become a small, powerful industry in Washington.

When Gray took over the Washington office in 1961, Hill and Knowlton had four employes; today it has 101. It is the largest of the 10 major public-relations firms in Washington. It represents outfits like the American Iron and Steel Institute, FTD Florists, and Metropolitan Edison (the firm that operated the Three Mile Island facility).

"In the early days, I didn't feel I had lobbied unless I had personally talked with the member of [of Congress]," he said. "In the old days you could lobby a small number of people . . . now you talk to a member and he says, 'Let me talk to my staff person assigned to this issue.'"

With the advent of staff power, he said, it is often "more effective to use younger and female lobbyists because they're talking to and interfacing with younger and female staff people."

Gray has also been a loyal Republican, rounding up large contributors and working in campaigns. He can be discreetly direct; at the testimonial dinner for Gray, Senator Laxalt recalled Gray prepared him for his speech nominating Reagan by "diplomatically telling me it was not all that good."

"He has a way of watching for every opportunity to gauge who is in power in this town," said Thomas G. Corcoran, another old Washington hand who knows Gray socially. "He's very presentable."

He supported Reagan against Gerald Ford in 1976, a move other Washington hands thought foolish. "A lot of people said he was out of his mind," Martindale said. "From a p.r. point of view it was the dumbest thing he could have done. But he felt genuinely comfortable with Reagan's philosophy. And now Reagan's won and he's on top. And we're not."

Gray's idea of not working is writing his novel, "January River," a mystery about an art theft. His brother, asked if he'd ever seen Gray relax, said "I'm not sure."

At the end of his entry in "Who's Who," he added this quote: "When the young man raised in all the solid, basic virtues of the small town breaks out of his provincial cocoon into the city, he finds its variety invigorating, its cultural smorgasbord rewarding, its people mix exciting. The small-town work ethic is rise early and work hard.Add the stimulation of the city to that foundation and the result is high odds for career and lifestyle success."

Or, as Gray said the other day, "I could never have stayed in Nebraska."