When Rush Limbaugh died this year, the mainstream media he had so long railed against gave him the kind of immaculately choreographed send-off that was once reserved for popes and presidents.

Within minutes of his widow announcing his death, major news organizations hit the “publish” button on sophisticated surveys of his life and career — the Associated Press describing the talk-radio titan as “an architect of the modern right-wing,” the New York Times reminding that he “pushed baseless claims and toxic rumors” well before social media emerged as our most potent vector of disinformation.

These obituaries had been years in the making. Long before Limbaugh announced in early 2020 that he had lung cancer, journalists had begun assembling their stories about his death, not knowing when the news would indeed be news — just that it would be a gigantic story when it happened.

Once a sleepy corner of journalism, obituaries have found new life in the Internet era. A well-crafted obit for a prominent figure — blending history and biography, triggering nostalgia or perhaps even the reader’s own feelings of mortality — can attract enormous readership online. And now there’s a need for speed: The obit that comes out first, or at least fast, can win the day.

That’s why many news organizations have bolstered their stockpiles of pre-written obits, known as “pre-writes” or “advancers,” creating vast portfolios of deaths foretold. The New York Times has 1,850 such obits idling in its computer system, according to William McDonald, the newspaper’s obituaries editor; The Washington Post has about 900 on hand, said its obituaries editor, Adam Bernstein.

“We’ve ratcheted it up in the last few years,” said Mike Barnes, senior editor of the Hollywood Reporter, which now has more than 800 obituaries written for still-living notables spanning the entertainment industry — from actors and directors and studio heads to production designers and makeup artists. Barnes himself has written about 500 of these over the past 10 years. “It’s gotten to be so competitive.”

The “morguing” of obits, in the ghoulish jargon of the trade, makes obituaries unique in journalism. No other kind of news story can be written so long before an event occurs, driven by one great certainty: At some point, the famous, the infamous and everyone else will die.

Baby boomer nostalgia has stoked some of the interest in the lives and deaths of the famous, said Hillel Italie, an Associated Press reporter who has written obituaries of leading cultural figures. Older readers have “a growing awareness of their mortality and sensitivity to the passing of those who helped define their lives,” he said, citing the hunger for news about the August death of Rolling Stones drummer Charlie Watts at 80.

But the untimely deaths of younger celebrities are a proven draw as well: One of the most-read obits in The Washington Post’s history was that of actress Brittany Murphy, who died suddenly in 2009 at the age of 32. The September obituary for actor Michael K. Williams, 54, racked up 2.8 million views for the New York Times; the obituary of comedian Norm Macdonald, 61, a week later surpassed 1 million.

Even an obituary for a lesser-known actor, Willie Garson, 57, who had a recurring role on “Sex in the City,” approached 1 million views, McDonald said.

Given the breadth of obituary-worthy VIPs and the randomness of death, however, it’s impossible to be ready for everyone. Macdonald, Murphy and Garson caught obit-desk writers by surprise, forcing them to scramble. There were also no advancers for basketball legend Kobe Bryant, when he died at 41 in a helicopter crash early last year, nor for Michael Jackson, James Gandolfini and Chadwick Boseman, all of whom died unexpectedly.

After Murphy and Jackson’s deaths in 2009, though, some obituary editors took a hard look at some younger superstars with chaotic lives. And when British pop diva Amy Winehouse died at age 27 in 2011 after a public struggle with addiction, The Washington Post had a prewritten obituary ready to publish.

The Post’s first obituaries editor, J.Y. Smith, wrote so many advance obits that his name continued to appear in the newspaper more than a dozen years after his death in 2006, including on the obituaries of former president Gerald Ford and former Chilean dictator Augusto Pinochet. As Smith himself lay dying in a hospice, he made one request of Bernstein: “Don’t let them screw with my [Fidel] Castro obituary!” (Written more than two decades before Castro’s death, it was periodically updated and published a decade after Smith’s.) The Post’s obituary for Colin Powell, which published upon the former secretary of state’s death last month, was written 12 years ago by former staff writer Bradley Graham, shortly before he left The Post in 2009.

While advance obits had generally been reserved for household names — “If you made news in your lifetime, your death will be news,” said McDonald — obituary writers have ranged more widely in recent years, finding that the lives of lesser-known figures often are just as revealing, and just as widely read.

When he became the Boston Globe’s obituaries editor in 2005, Bryan Marquard recognized “a built-in demographic disparity” — an overload of subjects in government, academia, medicine and business, with the kind of well-placed friends who know how to lobby for a prime death notice. And so he set out to feature women, people of color, members of the LGBTQ community, even the homeless — including an obituary for a woman who lived on Boston’s streets for more than 25 years.

“I believe everyone has one good story in them,” said Kay Powell, a like-minded former obituaries editor for the Atlanta Journal-Constitution, whose subjects included a woman who sang at Martin Luther King Jr.’s funeral and a health department bureaucrat who introduced pasteurized milk to Georgia. “It’s up to us to find it and write it.”

More recently, the New York Times launched “Overlooked,” a series of retroactive obituaries for noteworthy people who were snubbed for coverage at the time they died.

The preference remains getting them while they’re fresh, though — with some writers going to extraordinary lengths to report out blockbuster obituaries before they happen.

The Post’s Bernstein set out more than two years ago to memorialize the life of Annabel Battistella Montgomery, who under the stage name of Fanne Foxe played a role in one of the defining Washington sex scandals of the 1970s. An Argentine-born exotic dancer, she had an affair with the powerful Arkansas congressman Wilbur Mills that came to light after she jumped into the Tidal Basin during a 1974 police stop of their car.

But Montgomery retreated quickly from the spotlight, shunning the press for the next four decades. In February, Bernstein happened to spot a small paid death notice in the Tampa Bay Times that had been placed by her family; he spent a weekend calling dozens of funeral homes to attempt to confirm her death before tracking down her death certificate through the coroner’s office — allowing him to break the news of her death.

While attempting to report another advance obituary five years ago, New York Times reporter Robert D. McFadden made a startling discovery: His subject was already dead.

Donald W. Duncan was a Green Beret who served in Vietnam before becoming a leader in the antiwar movement. Hoping to find more about his life, McFadden instead stumbled across a brief obituary of a man by the same name, published in 2009 by a small Indiana newspaper. The clip didn’t mention anything about Duncan’s role as a war critic, but other biographical details aligned. McFadden tracked down Duncan’s daughters, who confirmed that the man in the Indiana obit was the antiwar activist.

So the Times published Duncan’s obit in 2016 — seven years after his death.

“The thinking was, we would have written about Mr. Duncan immediately after he died had we known, so we should apply the same standard now,” wrote McDonald, the obituaries editor. “His death, in a sense, was still news, and his story still deserved to be told.”