All the White House comings and goings raise a question: What does it take to remain in President Donald Trump’s favor and keep your job? If the show were called Survivor: White House Edition (and with the former Apprentice host as president, the conceit feels apt), what sorts of skills does one need to avoid the ax?

No president in recent memory has churned through senior aides and Cabinet officials at a faster clip than Trump, with turnover accelerating as he fumes over his administration’s struggle to curb migration at the southern border.

Last week, Trump began clearing out the upper echelon of the Homeland Security department. First, he tweeted the ouster of the department’s secretary, Kirstjen Nielsen, then followed by removing Secret Service Director Randolph “Tex” Alles. More firings loom as Trump loses patience with officials who can’t create the impregnable border he demands.

Nielsen’s is the 15th Cabinet-level departure since Trump took office a little more than two years ago, Kathryn Dunn Tenpas of the Brookings Institution told me. By comparison, after three full years in office, Barack Obama presided over seven Cabinet-level departures; George W. Bush, four.

“It’s not just higher” under Trump, Tenpas said. “It’s off the charts.”

Not all that many high-ranking aides remain from the day Trump gave his inaugural address. Two-thirds of Trump’s most senior aides have left or been promoted, more than every president going back to Ronald Reagan in the 1980s, Tenpas’s research shows. But there are a few survivors. Amid all the tumult, some have even flourished. The keys: praising Trump, mastering skills that he values, and forging alliances in a rivalrous West Wing.

If none of that works, plant yourself in front of a TV camera and impress the boss.

Consider Stephen Miller, the 33-year-old who started during the campaign. Miller’s portfolio is expanding. In recent weeks, Trump has given him a lead role on Miller’s pet issue—immigration policy. Trump told him: “Whatever you need, you’re empowered in this space; get it done,” a White House aide says.

Miller has long wanted tougher measures to control migration to the U.S. In that respect, he’s in sync with Trump’s core voters—part of his value to the president. “He’s a policy adviser who has the pulse of the president’s base,” a former White House official says. “And like the president, he’s skeptical of the standard Washington playbook on trade and immigration.”

Miller is a curious case in that Trump often prizes aides who perform well on cable TV, whose coverage he devours. Over the past two years, Miller has had some epic appearances on the small screen. In a cool medium, he runs hot. But he’s defended Trump to the point that he’s nearly gotten himself thrown off the set. And make no mistake: For a White House aide, the defense, promotion, and celebration of Trump is a durable survival strategy.

In an appearance last year on CNN (arguably Trump’s least favorite news outlet), Miller denounced “24 hours of negative anti-Trump hysterical coverage on this network.” As Miller attempted to drown out the host with stories about Trump’s virtues, Jake Tapper observed that he was really addressing an audience of one.

Aides say that Miller is a popular figure inside the building, though, bringing in bagels for the staff. At a birthday party for Miller and a couple of other aides on the chief of staff’s patio, Trump made a surprise appearance.

An undeniable asset is his speechwriting skills, past and present White House aides say. He has a feel for Trump’s voice—a skill that Trump believes “he can’t live without,” one former aide says.

Miller has also been nimble when it comes to internal White House politics. He was first thought to be an acolyte of the former chief strategist, Steve Bannon. Both touted economic nationalism, putting them at odds with a globalist faction led by the former economic adviser Gary Cohn and the president’s son-in-law, Jared Kushner. But Miller made certain not to alienate the globalists nor to make Bannon’s mistake of antagonizing Trump’s family.

In his book, Team of Vipers, the former White House aide Cliff Sims wrote that he once overheard a conversation between Miller and the president. Walking outside the White House together, Miller told Trump that his poll numbers would be even higher if Bannon would just stop leaking to the press. Knife stuck inside the unsuspecting Bannon, Miller “twisted it with relish,” Sims wrote.

Bannon was gone after seven months.

“There’s a reason Miller outlasted so many in the West Wing,” Sims wrote.

No one risks getting fired for being too effusive in praise of Trump. A few who took a more jaundiced view are out. Former White House Counsel Don McGahn privately referred to Trump as “King Kong,” people familiar with the matter said. Ex–Secretary of State Rex Tillerson called Trump a “moron.”

Perhaps the most obsequious of all the president’s men and women is his No. 2, present and past White House staff members say.

In public, Vice President Mike Pence has likened Trump to towering historical figures. “From King David’s time to our own, President Trump has now etched his name into the ineffaceable story of Jerusalem,” Pence said in a speech last year at the Israeli embassy in Washington.

Behind closed doors he is no less gushing, taking pains to ensure that Trump has no cause to turn on him, people familiar with the matter said. “I’d like my wife to look at me just for one day the way Mike Pence looks at President Trump every day they’re together. That would be special,” Kenneth Adelman, an official in Reagan’s administration, told me.

Under the Constitution, Trump can’t fire Pence. Yet he could rid himself of the vice president by dropping him from the 2020 ticket. Or he could use his Twitter feed to marginalize and humiliate Pence. That’s been known to happen. But Pence never seems to run afoul of Trump. Some of it may be his hardwiring: He has an innate deference to power, people who have worked with him say.

“Submit yourselves to the authorities placed above you,” Pence told graduates at the Coast Guard Academy commencement ceremony last year. “Trust your superiors.”

His superior seems pleased. Rudy Giuliani, Trump’s lawyer and confidant, told me that the president once said to him that making Pence his running mate was “probably the best choice I made—and I made a few bad ones.”

Pence rarely disagrees with Trump in staff meetings, a practice that has irritated some White House aides who wish he’d take a bolder stand. Cohn might have found himself among them. Working in his West Wing office in the summer of 2017, Cohn looked up to find an unexpected visitor at his door: the vice president.

Both men had just been in a tense meeting in the Oval Office, during which Cohn told Trump that he might have to quit coming off a news conference in which the president said there were “some very fine people” among the white supremacists who marched in Charlottesville, Virginia.

In front of the president, Pence said nothing to back up Cohn. After the meeting broke up, he climbed the flight of stairs to Cohn’s office and told him he’d been right, people familiar with the matter said. “I’m proud of you,” he told Cohn—a declaration that might have had more meaning had it been made in Trump’s presence.

People close to Pence have said that he didn’t recall the conversation with Cohn and that he had no need to speak up in the Oval Office that day, because he had already made clear his objections to white supremacists during a prior news conference in South America. They’ve also insisted that he speaks candidly with Trump.

In the president’s first year, he called a meeting in the Oval Office to tell aides he was pulling out of the NAFTA free-trade accord. He wanted the paperwork drawn up immediately. In Congress, Pence had voted repeatedly for free-trade deals. Speaking on the House floor in 2001, Pence touted NAFTA and the benefits it brings to Indiana farmers. “As the nation’s sixth-largest corn producer, Indiana benefited directly under” NAFTA, he said.

Aides were hopeful that Pence, given his history, would speak out and dissuade the president from abruptly scuttling NAFTA. Instead, at the Oval Office meeting, he told Trump he was “a strong leader” and said that pulling out of NAFTA would “send a powerful message,” people familiar with the matter said.

Mr. Trump would later retreat from the brink, choosing instead to renegotiate the NAFTA accord with Mexico and Canada.

Some past vice presidents saw their role differently. Before taking office, Jimmy Carter’s vice president, Walter Mondale, wrote a memo to Carter saying he wanted to be a source of unvarnished advice. “The biggest single problem of our recent administrations has been the failure of the President to be exposed to independent analysis not conditioned by what it is thought he wants to hear or often what others want him to hear. I hope to offer impartial advice and help assure that you are not shielded from points of view that you should hear,” Mondale wrote. He meant it.

Two years later, he sent Carter another memo describing the president’s speeches as “fairly heavy and incomprehensible, lacking the eloquence and persuasiveness that a Presidential address should possess.”

It’s tough to imagine Pence composing such a memo, and even tougher to see Trump taking it well. For decades, presidents and vice presidents have held regular one-on-one lunches with no aides present. The ritual helps build trust and, because only two people are at the table, prevents leaks, veterans of past White Houses said.

Trump ditched that tradition. Instead he has invited to the lunches both his and Pence’s top aides. At the meals in the small dining room off the Oval Office, Trump keeps a big-screen TV tuned to cable news. Aides who have walked in have seen Trump yelling at the TV as he sits with Pence and their deputies over plates of chicken and cheeseburgers. When he sees something on the screen that he dislikes, Trump on occasion will interrupt the lunch and summon aides to discuss a response, people familiar with the lunches said.

Trump has made clear that Pence is in his debt. When he put Pence on the ticket in 2016, Trump spared him a difficult reelection bid in the Indiana governor’s race. At a dinner in the White House’s Blue Room in 2017, Trump told supporters how he had wanted Pence’s endorsement in the Indiana primary, but didn’t get it. Pence instead endorsed Senator Ted Cruz of Texas.

So Trump instead sought and received an endorsement from the former Indiana University basketball coach Bobby Knight. “I had the most valuable endorsement: Bobby Knight,” Trump said, according to a person in the room. “I won the primary.”

“And now look where you are, Mike.”

In a good place, that’s where. Three years ago, Pence was fighting to keep his job as Indiana’s governor. Now he’s a heartbeat from the presidency. Once Trump leaves the scene, Pence will look to inherit Trump’s base should he seek the Republican presidential nomination.

While the roots of Pence’s staying power are immediately obvious, Kellyanne Conway’s longevity has left some White House alumni flummoxed. Aides have long suspected her of leaking to the press. Her husband, George Conway, repeatedly swats at Trump on Twitter. Yet she endures.

TV is one reason. More than anyone not named Trump, Conway is the White House’s public face.

“One thing that will never go out of style in the Trump White House is someone who is willing to go on TV and defend the president, no matter what is going on,” Sims said in an interview. “Kellyanne has proven she’s willing to do that anytime and anywhere. Love Kellyanne or hate her, she is generally good at arguing with people on television.”

She has another advantage. With a fluid portfolio, she doesn’t have the clear, direct responsibility for a controversial policy area that Trump cares about. That’s what sunk Nielsen, who had command of border security and immigration issues, which are Trump’s constant focus.

Beyond that, the cost of jettisoning Conway may be too high. Were she to lose her job and turn on Trump, she’d be a tough adversary. “He doesn’t want her on the outside looking in,” said one former administration official.

Elaina Plott contributed to this article.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.