I think this is Futuretrack 5 (1983), by Robert Westall.
It's set in a future where everyone's allotted role is decided by a series of tests once they reach a certain age. They are then classified into a group which decides what jobs they will do.
The protagonist has to take his E-levels, which will determine his fate:
What had it all been for, that sweating on mast and field gun, that swotting of antique facts?
Well, the dreaded E-level results, for one thing. O-levels at fifteen, A-levels at seventeen, X-levels at nineteen, and E-levels at twenty. ...
Twenty minutes to seven. E-level results in fifty minutes. By then, most of us would be Ests for life, not just children of Est families. ...
Some of us, the ones who failed the E-level, would be packed into vans and driven through the Wire and never heard of again.
Our hero rather controversially gets a perfect score in the tests. Nobody had done that in a long time. and at first he worries about what this might mean.
“What was the last thing I said to you, before the exam?”
“You told me not to score a hundred percent, sir.”
“Well, that’s what you did wrong.”
“I thought you were joking, sir.”
“Well, I wasn’t. You scored a hundred percent and they’ll never forgive you.”...
He is sent to work for the mysterious scientists who maintain the computer that runs society. Most people don't know they exist.
Because of his perfect score, he becomes a Tech:
“Techs. Don’t you know what a Tech is?”
“No—I thought I was going to the lobo-farm …”
“You are. Don’t panic! Us Techs run the lobo-farm. And everything else.”
“Never heard of you.” ...
“...We let the Ests write the cruddy play and play all the heroic noble parts. But who built the theater? Who lays on the lighting and the music and the tape-recorded clapping at the end? Techs, squire, Techs! All three thousand of us. Every time you raise a glass of synthetic whisky to your rosebud lips, every time you go to the loo, you should raise your hat to the Techs. …”
He is disappointed to learn he has to be their tea boy, and learn a tea making ceremony perfectly.
The elaborate ceremony is in Chapter 4:
“Kitson, Henry, step forward.”
I took two steps forward, careful to touch nobody. This placed me exactly a yard from Headtech. My down-flicking eyes picked up the trolley, moving in soundlessly from the left. White, spotless, carrying ancient things. A chipped but shining teapot. An antique electric kettle, absurdly dangling a black cable, because it had no power cell of its own. Once it had been chrome, but years of polishing had stripped it to bare copper.
“Kitson, Henry, will make the tea.”
Again, that indrawn breath of envy.
“Depress the red button,” intoned Headtech. “Pour boiling water into the teapot, first removing the lid. Rotate the pot clockwise until it is thoroughly warm. Always
warm the pot.”
A censorious echo from the waiting ranks:
“Always warm the pot.” Like a church service.
“Take the spoon,” intoned Headtech softly, his pebble glass roaming the ranks. “Transfer two spoonfuls of Indian tea leaves into the pot. One for each person, and one for the pot.”
“One for the pot,” echoed the ranks.
It was hard not to giggle. It was hard to stop my hand trembling, spilling a few black tea leaves onto that shining white trolley. Every eye watched for my slightest error. One black speck would have ruined my career. But I managed it safely.
“When the velocity of steam issuing from the kettle no longer increases, fill the pot.”
I watched the jet of steam grow longer and longer.
“Enough,” said Headtech. “Pour.” His voice was sharp with exasperation. But the fatal error would have been not waiting long enough…
He becomes tea boy to Idris, who made the computer, Laura, which runs everything:
The months I spent with Idris were never easy. ... But the night he made an anatomical suggestion to the Prime Minister made me realize how much power he and Laura had. In the thirty years since Idris built her, from stolen parts, in a locked loo of this very toilet, Laura had gathered all knowledge to herself. ... The Ests found out after a year, when Idris started correcting other people’s programs. By then, it was too late. The Ests demanded Laura be revealed and dismantled. Idris retaliated by sending the Treasury computer berserk. It stampeded the money markets and in one day Britain lost a thousand million Eurocredits. The Ests surrendered...
In the process he learns how to fool the machine, and eventually to circumvent the controls society has placed on him. He makes several visits to an area outside the control of the machine - where people are living in poverty and lawlessness.
After Idris dies, he goes through the Wire, to where the Unnems live:
The entrance to razzle land didn’t match up to the nods and winks in our dining hall. Extra-high Wire; guard post with Paramils, leashed Alsatian and gas-thrower pointing inward. Techs had been known to return to that gate prematurely, in a hurry and with unwelcome company.
Otherwise, an endless vista of council blocks marched away downhill into the drizzly night. The pale blue nicker of the Box came through every uncurtained window. Unnems only had one TV program, black and white, so every block of windows jumped and flickered simultaneously, like a huge and boring light show.
He eventually discovers various hidden truths about the society.