The abrupt ouster of Sam Altman on Friday as chief executive of OpenAI, one of the world’s most prominent A.I. companies and the maker of ChatGPT, sparked a head-spinning series of twists that culminated late Tuesday with Mr. Altman’s reinstatement at the company he founded and pledges to overhaul the way OpenAI is run.

The turmoil highlighted an unresolved debate over artificial intelligence, which many see as the most important new technology since web browsers but also a potential source of danger if misused.

Here’s what you need to know about Mr. Altman’s departure, his return and what could happen next.

On Friday, Mr. Altman was dismissed as OpenAI’s chief executive. A dispute with a colleague appears to have played a role.

Ilya Sutskever, a board member who founded OpenAI with Mr. Altman and several others, was said to be growing alarmed that the company’s technology could pose a significant risk, and that Mr. Altman was not paying close enough attention to the potential harms. He and three other members of OpenAI’s six-member board formed a majority that decided to dismiss Mr. Altman.

The board was tight-lipped about the reasons for his ouster, noting only that Mr. Altman “was not consistently candid in his communications with the board.” Greg Brockman, OpenAI’s president who along with Mr. Altman also served on the company’s board, quit in protest.

It was confusion among employees at OpenAI, and distress among the company’s investors. Microsoft, which has invested $13 billion in the company, was said to be particularly alarmed and with other investors pressed the board over the weekend to reinstate Mr. Altman, without success.

On Sunday evening, after 48 hours of furious negotiations over the company’s future, OpenAI’s board said it would stand by its decision to oust Mr. Altman and named the second interim chief in two days: Emmett Shear, a former executive at Twitch, would succeed Mira Murati, a longtime OpenAI executive who had been appointed interim chief on Friday.

Late Sunday, Satya Nadella, Microsoft’s chief, announced that he intended to hire Mr. Altman and Mr. Brockman, to lead an advanced A.I. research team at the tech giant.

He said Microsoft “remain committed to our partnership with OpenAI.” Microsoft’s stock, which had been rattled by the turmoil at OpenAI, recovered its losses and rose to a record high.

By Monday morning, almost all of OpenAI’s nearly 800 employees had signed a letter saying they might quit to join Microsoft unless the start-up rehired Mr. Altman and all of the company’s board members resigned.

Curiously, Mr. Sutskever also signed the letter. He posted on X saying he deeply regretted his role in the board’s decision and would “do everything I can to reunite the company.”

Late Tuesday, OpenAI announced an “agreement in principle” for Mr. Altman to return as chief executive of OpenAI, the culmination of the campaign waged by his allies, employees and investors.

Mr. Brockman also returned to the company. “We are so back,” he posted on X, along with a selfie in front of a crowd of OpenAI employees, who celebrated in the company’s office.

Mr. Altman and Mr. Brockman return to a changed company, starting with the board that ousted them.

After all the tumult, OpenAI now has a fundamentally different, three-member board of directors — for now.

Departing the board are Mr. Sutskever; Helen Toner, a director of strategy at Georgetown University’s Center for Security and Emerging Technology; and Tasha McCauley, an entrepreneur and computer scientist.

Adam D’Angelo, chief executive of the question-and-answer site, Quora, is the only holdover from OpenAI’s existing board. He was among those who pushed Mr. Altman out, but then over the weekend led the talks to bring him back, according to two people in touch with the board.

Coming in as chairman is Bret Taylor, the former co-chief executive of Salesforce, an enterprise software company, will serve as chairman. Mr. Taylor is also former chairman of Twitter, and was in the middle of last year’s clashes with Elon Musk, who initially agreed to acquire Twitter and then tried to back out of the deal. (Mr. Musk was a founder of OpenAI in 2015, but left the company three years later.)

Lawrence Summers also joins the board. Mr. Summers, a former Treasury secretary, Harvard professor and veteran of the Clinton and Obama administrations, remains a prominent economic voice in Washington.

The company described the reshuffle as a “new initial board,” suggesting more members may be coming.

Mr. Nadella of Microsoft said that he was “encouraged” by the changes to the board, calling it a “first essential step on a path to more stable, well-informed, and effective governance.”

The upheaval at Open AI highlighted an industry split between so-called doomers, who say the technology is moving too quickly, and others who argue it can make lifesaving enhancements.

Ms. Toner, the departing OpenAI board member, had attracted Mr. Altman’s scorn with a paper she had co-written recently for the Georgetown center where she works. Mr. Altman complained that the research paper seemed to criticize OpenAI’s efforts to keep its A.I. technologies safe.

More than 1,000 tech leaders signed a letter in March calling for a pause in the development of A.I.’s most advanced systems, saying the tools have “profound risks to society and humanity.”

Mr. Altman, who did not sign that letter, has urged responsible management of A.I. while also promoting the technology, and in recent months pitched ideas to investors and others.

Mike Isaac, Cade Metz, Tripp Mickle, J. Edward Moreno, Kevin Roose and Karen Weise contributed reporting.