The ouster of Bill O’Reilly, the top-rated cable news host, from Fox News capped an extraordinary period of upheaval at the company, marked by a series of sexual harassment allegations that resulted in the downfall of Roger E. Ailes, the powerful chairman of the network, as well as a damaging exodus of advertisers.

Here is a look at the nine and a half months that shook the network:

JULY 6, 2016

Carlson files a harassment suit against Ailes

Gretchen Carlson, a prominent Fox anchor, sends shock waves through the media world when she files a lawsuit against the Fox News chairman, Roger E. Ailes, accusing him of forcing her out after she refused his sexual advances and complained to him about persistent harassment in the newsroom.

Ms. Carlson’s charges included an allegation that Mr. Ailes, during a meeting in his office, explicitly asked her for a sexual relationship, a public attack on a towering figure in broadcast journalism and Republican politics who had typically enjoyed absolute loyalty from his employees.

JULY 20, 2016

More harassment claims against Ailes

The accusations do not stop with Ms. Carlson. The law firm Paul, Weiss, Rifkind, Wharton & Garrison, hired by 21st Century Fox, the network’s owner, to investigate Ms. Carlson’s allegations, takes statements from at least six women who describe inappropriate behavior by Mr. Ailes, according to people briefed on the inquiry.

The details of the allegations are reportedly deemed troubling enough that they lead 21st Century Fox to begin planning the end of Mr. Ailes’s reign at Fox News.

JULY 21, 2016

Ailes is forced out

Rupert Murdoch, the media mogul who started Fox News with Mr. Ailes, tells stunned employees in Fox’s Midtown Manhattan headquarters that Mr. Ailes is out as chairman and chief executive and that Mr. Murdoch himself will take over Fox News in the interim.

Mr. Ailes walks away with about $40 million as part of a settlement agreement, which essentially amounts to the remainder of his contract through 2018.

AUG. 12, 2016

Two Ailes deputies are promoted

Despite Mr. Murdoch’s pledges of a fresh start at the network, two veteran executives with deep ties to Mr. Ailes are named co-presidents of Fox News.

Bill Shine, an affable Ailes loyalist who is well liked by some of the network’s longest-serving anchors, is selected to oversee programming at Fox News and Fox Business Network. Jack Abernethy, a trusted Murdoch hand, is placed in charge of business operations, including finance and advertising sales.

SEPT. 6, 2016

Ms. Carlson reaches a settlement

21st Century Fox spends $20 million to settle the former anchor’s lawsuit. Specialists in employment law describe the payout as among the largest known settlements for a single-plaintiff sexual harassment suit.

JAN. 3, 2017

Megyn Kelly leaves Fox News for NBC

Ms. Kelly, a bona fide Fox star who played a breakout role in the presidential campaign when she clashed with Donald J. Trump, leaves Fox months after releasing a book in which she described being sexually harassed by Mr. Ailes.

Ms. Kelly’s exit is so abrupt that it is announced on the day the network runs a full-page ad in The Wall Street Journal trumpeting the ratings of its prime-time lineup, with Ms. Kelly prominently pictured.

It is later revealed that comments by Mr. O’Reilly about the sexual harassment allegations at the network, along with her deep skepticism about whether the network was truly committed to changing its culture, were factors in Ms. Kelly’s decision to leave Fox News for a new role at NBC News, according to two people familiar with the matter.

APRIL 1, 2017

O’Reilly revelations

An investigation by The New York Times reveals that five women received payouts totaling about $13 million from Mr. O’Reilly or the company in exchange for agreeing not to pursue litigation or speak about their accusations of sexual harassment or other inappropriate behavior against him.

Two settlements had come after Mr. Ailes’s dismissal, when the company had said it would not tolerate behavior that “disrespects women or contributes to an uncomfortable work environment.”

APRIL 6, 2017

Advertisers flee ‘O’Reilly Factor’

After a groundswell of anger, fueled by social media, over the revelation of the harassment suits against Mr. O’Reilly, more than 50 companies pull their ads from his top-rated program, “The O’Reilly Factor.”

APRIL 19, 2017

O’Reilly is ousted

In a one-sentence statement, 21st Century Fox announces that Mr. O’Reilly, who had been away on vacation, will not return to Fox News, bringing an end to his two-decade reign as one of the most influential commentators in television. The move comes amid new allegations against him.