For the past month, “Jeopardy!” episodes have followed a pattern.

The theme music plays. The three contestants stand at their lecterns. Then two of them are clobbered by a mild-mannered bureaucrat from New Jersey named Jamie Ding.

But on Monday’s episode, the unthinkable happened: After 31 victories, Ding lost.

His streak is the fifth-longest in “Jeopardy!” history. He fell just one win short of matching James Holzhauer’s 2019 run, and he left the Alex Trebek Stage with more than $880,000 in winnings.

Early in the game broadcast on Monday, Ding found himself lagging behind Greg Shahade, an International Master in chess who was lightning-fast on the buzzer. During Final Jeopardy, Ding jotted down the correct response to a clue about South African languages — but it wasn’t enough to make up the deficit.

“It was over, just like that,” Ding, 33, said in an interview.

Contestants who went up against him included a statistician, a librarian and a professor. Ding produced so many correct answers (always in the form of a question) that it seemed he might never run out.

“Who was Trotsky?”

“What are non-Newtonian fluids?”

“What are waffle fries?”

Throughout his reign, he was matter-of-fact as he came up with arcana in a split second (“What is cuneiform?”). He endeared himself to viewers through his comically humdrum banter with the show’s host, Ken Jennings, about such topics as his favorite color (orange), his favorite letter (F) and his favorite number (6).

As the streak continued, the drama-free anecdotes and humble bits of personal information shared by Ding seemed to amuse Jennings, a former “Jeopardy!” champ who holds the record for consecutive wins, with 74.

The depth of Ding’s knowledge went along with a lack of bluster. He proudly identified himself as a “faceless bureaucrat.” When he won a game, he looked pleasantly surprised, as if he had been given an unusually good free sample at Trader Joe’s.

“Put Jamie Ding on the $20 bill,” one fan demanded in a tribute on the newsletter platform Substack.

After his “Jeopardy!” loss had been taped but before it was broadcast, Ding gave a video interview from his two-bedroom apartment in Lawrenceville, N.J.

There he was, in front of an orange couch and a stuffed orange clownfish. He said he had remained calm throughout his final game, even as he realized that he was on his way to a loss. He went backstage and stared at the mostly orange clothes he had brought along in the hope that his streak would continue.

“During it, I was trying to stay grounded,” he said. “Planning to win a whole bunch of games of ‘Jeopardy!’ just feels like asking to lose.”

Ding filmed the show in five-episode chunks in Los Angeles during vacation days from his job as a program administrator for the New Jersey Housing and Mortgage Finance Agency. His work involves administering tax credits to build affordable housing in the state.

In an early appearance, he praised New Jersey’s efforts on the issue compared with those of New York, Connecticut and Pennsylvania. “If you’re from one of those states, then shame on you,” he said. “Build more housing.”

He spends his time away from his job studying law at Seton Hall University. He said he did not expect his “Jeopardy!” windfall to change his life all that much. He planned to donate some money and put the rest in a high-yield savings account.

In a way, Ding said, he had been preparing for the show since childhood. The son of a neuroscience professor and a high school math teacher, he grew up in Grosse Pointe Shores, a suburb of Detroit. He competed in geography bees and on his high school quiz bowl team. He recalled losing a sixth-grade spelling bee when he misspelled the word “bolero.”

“B-a-l-l-e-r-o,” he said. “Terrible.”

As an undergraduate at Princeton, he studied molecular biology, thinking he might become a doctor. But a year as an AmeriCorps Vista program member in Jersey City, N.J., nudged him toward working to address the housing crisis.

Ding admitted he was not a regular “Jeopardy!” viewer until early this year. Still, he had taken the online qualification test several times. In November 2024, a producer asked him to audition over Zoom. After learning he had been cast, he started studying in earnest.

“I checked out a big stack of books, like an atlas and a book about Shakespeare by Isaac Asimov,” he said.

His sister, Jessie Ding, a 31-year-old lawyer, caught him up on pop culture, telling him all about the HBO show “Industry” and helping him identify the faces of various celebrities. He practiced buzzing in quickly using a retractable highlighter.

By his third victory, it was clear that Ding had the stuff to make a deep run, said Andy Saunders, the publisher of the website The Jeopardy! Fan. In that game, he responded to 45 clues correctly, tying a record set by Jennings during his streak in 2004.

Ding was a relatively conservative player, avoiding the all-in wagers on Daily Doubles that were a go-to stratagem for Holzhauer. But he was unusually fast on the buzzer and seemed to have few weak categories.

“The key to Jamie’s run really has been his incredibly wide base of knowledge in just about any category you can think of,” Saunders said.

Ding used a tactic he called “knight moves” — traversing the board in an L-shaped pattern, like a knight in chess. Maybe it threw his opponents off-balance, or maybe it was just nice to have a simple rule to follow, he said. “It’s basically a guaranteed way to pick something of a different difficulty, and in a different category,” he added.

He watched his first “Jeopardy!” appearance at Pint, a bar in Jersey City, with friends from so many different groups that it felt like a wedding. He is still getting used to the attention that comes with being a TV star.

“Watching my episodes, I can be pretty self-critical — like, Why did you do that? Or, What’s wrong with your face?” he said. The outpouring of support has been worth the discomfort. “I’m trying to keep a list of people who did nice things for me because it’s so many,” he said.

Now that his streak has ended, he can return to his hobbies, like constructing cryptic crosswords and running an Instagram account rating General Tso’s chicken with his sister. He is also part of a group of intervenors seeking to block the U.S. Department of Justice from obtaining New Jersey’s voter registration records.

It won’t be long, though, before he starts studying for the “Jeopardy!” Tournament of Champions. He might even need some more orange clothes.

“I have a reputation to uphold,” he said.