Roger Ailes, who combined political savvy with television showmanship to build the Fox News Channel into a conservative media juggernaut, but whose fabled career ended abruptly last year amid a sexual-harassment scandal, died Thursday. He was 77 years old.

Mr. Ailes, a hemophiliac who had been in failing health, was hospitalized in recent days after complications from a fall, a person familiar with the situation said.

“I am profoundly sad and heartbroken to report that my husband, Roger Ailes, passed away this morning surrounded by his beautiful family,” Mr. Ailes’s wife Elizabeth said in a statement Thursday. Besides his wife, Mr. Ailes is survived by his son Zachary, brother Robert, and sister Jean.

Mr. Ailes pioneered a style of cable news with opinionated, right-leaning prime-time programming delivered by pugnacious hosts. It was an approach that delighted conservatives and proved extremely successful financially, even as it often triggered a negative response from liberal audiences.

A 50-Year Career Roger Ailes in 1968 Ed Farrand/Getty Images

A look back at a career dating back to the 1960s that helped shape the modern conservative movement.

He had a instinct for making TV entertaining and knew how to pick and coach talent that others in the industry might overlook and develop those personalities into household names.

Through a career in politics dating back to the 1960s—advising the campaigns of Richard Nixon, Ronald Reagan, George H.W. Bush and, later, Donald Trump—and his leadership of Fox News, Mr. Ailes helped shape the modern conservative movement. Currying favor with the network’s huge audience became a must for Republican politicians with national aspirations and Fox News helped fuel some of the right’s most active and influential elements, including the Tea Party.

But he will also be remembered for the sexual-harassment scandal that led to his resignation last summer and threw Fox News into a period of turmoil. He left in July 2016, after a former network anchor sued him, alleging sexual harassment, and parent company 21st Century Fox Inc. investigated his conduct. Mr. Ailes denied wrongdoing.

21st Century Fox and Wall Street Journal-owner News Corp share common ownership.

Known for his bluntness and disdain for the so-called liberal media elites, Mr. Ailes was the perfect choice to execute media mogul Rupert Murdoch’s vision of launching a news channel that would serve as a thorn in the side of CNN and the evening newscasts of ABC, CBS and NBC.

“Roger and I shared a big idea which he executed in a way no one else could have,” Mr. Murdoch said in a statement Thursday. “He will be remembered by the many people on both sides of the camera that he discovered, nurtured and promoted.”

Mr. Ailes once said that his first qualification to run a news operation was “I didn’t go to Columbia Journalism School.”

When Fox News made its debut in October of 1996, few were optimistic about its chances of success. CNN had a 16-year head start, and NBC and the deep-pocketed Microsoft Corp. were launching MSNBC.

But Fox News’s mix of news and opinionated talk targeting conservatives struck a chord with Americans who felt their views weren’t being represented sufficiently in the rest of the media. The Fox News slogans “We report, you decide” and “Fair and Balanced” were mocked by rivals but became mantras for the network’s talent and audience.

Rupert Murdoch, right, and Roger Ailes at a 1995 press conference announcing that Mr. Ailes would head Fox News. Photo: peter morgan/Reuters

It took Fox News less than six years to surpass CNN in the ratings, but as far as Mr. Ailes was concerned, his news channel would always be the underdog.

After the triumph over CNN, rather than pat his team on the back he lectured them about complacency.

“I had to womp them and get them out of a winning mind-set,” he told The Wall Street Journal in a 2003 interview.

He also loved tweaking rivals. The marketing team at Fox News became known for its aggressive attacks against CNN and MSNBC as well as being more than willing to disparage anyone who might challenge their own credibility or write favorably about their rivals.

“He had enormous skills yet he had this dark side that mobilized his life a lot,” said Robert Wright, the former chairman of NBC who hired Mr. Ailes to run CNBC in the 1980s and remained close to him over the years. Mr. Ailes, he said, seemed as if he “had to have a target every day to keep him going.” Once you crossed, him, Mr. Wright said, he could get very angry. “You’re friend or foe, there is no middle.”

Mr. Ailes’s straddling of the line between politics and journalism made him a target of media watchdogs, who accused Fox News of being a megaphone for the Republican Party and coarsening the national discourse.

“Through a constant drumbeat of fear, anger, and hatred, he turned citizen-on-citizen,” said Jeffrey Jones, director of the Peabody Awards, which are given to broadcasters. “He helped craft an enormous gulf of distrust between people and news.”

Mr. Ailes dismissed such criticisms, countering in the authorized biography “Roger Ailes Off Camera” that “we’re not programming to conservatives, we’re just not eliminating their point of view.”

CNBC was a unit of General Electric Co. during Mr. Ailes’s tenure, and former GE Chief Executive Jack Welch said Mr. Ailes was “a raconteur of immense proportions” who left an “immense legacy.” Mr. Ailes, he added, also had a very compassionate side that only those closest to him saw.

Even rivals recognized his TV prowess. Former CNN President Jon Klein credited Mr. Ailes for embracing an audience that was underserved by other news outlets. He recalled a lunch with Mr. Ailes when the executive grumbled about getting no respect in town, even as people kept stopping by to greet him. “Roger, all these people are coming over to see you,” Mr. Klein recalls saying. “He said, ‘yeah but they hate doing it.’ ”

In this Aug. 17, 1988 file photo, Vice President George H.W. Bush, left, with Mr. Ailes, then his media adviser. Photo: Ron Edmonds/Associated Press

Mr. Wright said it was Mr. Ailes’s skills as a producer that made him a great political adviser. “He understood how to set up guests and get the best out of guests and how to put sets together in the most attractive manner,” he said.

Roger Eugene Ailes was born May 15, 1940, in Warren, Ohio, a blue-collar town in the northeastern part of the state. His father Robert was a factory worker who, at times, was physically abusive to his son. “He used an electric cord, a belt, whatever was handy,” Mr. Ailes said in the biography.

Mr. Ailes also suffered from hemophilia, which made him feel even more vulnerable as a child. At the same time, Mr. Ailes felt he had something to prove, both to his father and schoolmates. He didn’t back down from fights and played football.

After graduating from Ohio University, Mr. Ailes went to work on “The Mike Douglas Show.” It was there in 1967 that an off-the-cuff conversation with Mr. Nixon, then a presidential candidate, led Mr. Ailes into politics. Mr. Nixon, who had lost to President John F. Kennedy in 1960, was bemoaning having to go on television, which he called a “gimmick.”

Mr. Ailes told the future 37th president, “television is not a gimmick, and if you think that, you’ll lose again.” Mr. Ailes was soon running Mr. Nixon’s television strategy.

Mr. Ailes was later involved in the presidential campaigns of Messrs. Reagan and Bush as well as scores of other politicians including, most recently, Mr. Trump.

He returned to television full-time in the early 1990s, first as executive producer of a show for conservative commentator Rush Limbaugh and then as president of CNBC, the NBC-owned business news channel. He left in early 1996 after NBC decided to convert America’s Talking, another channel Mr. Ailes oversaw, into MSNBC, and give oversight of it to another executive.

At Fox News, Mr. Ailes was a hands-on executive who got deeply involved in selecting on-air talent. He assembled a team of commentators that included Bill O’Reilly and Sean Hannity. They developed loyal audiences, and their shows became go-to venues for conservative lawmakers and pundits.

Fox News proved a financial powerhouse, thanks to lucrative carriage deals with cable TV distributors and high ratings that translated into ad dollars. The network eventually accounted for some 20% of operating income for 21st Century Fox.

From the Archives Longtime Fox News Channel Chairman and Chief Executive Roger Ailes has agreed to resign amid accusations of sexual harassment and a related lawsuit. He will be replaced by Fox Executive Chairman Rupert Murdoch. WSJ’s Lee Hawkins reports. Photo: AP (Originally published July 21, 2016)

Because of Mr. Ailes’s success, Mr. Murdoch gave him far more autonomy than other executives at 21st Century Fox. That often caused tensions with other members of the Murdoch family. He clashed with Lachlan Murdoch over the operation of the company’s local TV stations and was seen as a key factor in the elder Murdoch son leaving the company in 2005 for several years.

When Rupert Murdoch appointed Lachlan and younger son James to the positions of 21st Century Fox co-executive chairman and chief executive, respectively, in 2015, Mr. Ailes initially was to report to them. He balked and ended up negotiating a deal in which he kept his direct line to the senior Mr. Murdoch.

Mr. Ailes’s fortunes began to change in the summer of 2016. In July, Gretchen Carlson, a former Fox News anchor, filed a lawsuit alleging that Mr. Ailes sexually harassed her and then retaliated against her—by sabotaging her career and not renewing her contract—after she rebuffed his unwanted advances.

Mr. Ailes denied the allegations, but more women—some from decades ago—came forward in media reports, alleging that Mr. Ailes had harassed them. 21st Century Fox soon launched an internal probe to examine Mr. Ailes’s alleged misconduct.

Just over two weeks after Ms. Carlson filed her suit, Mr. Ailes resigned, bringing a sudden end to his 20-year tenure. In his letter of resignation, Mr. Ailes didn’t address the sexual-harassment claims but told Mr. Murdoch, “I am proud that we have built Fox News and Fox Business channels into powerful and lucrative news organizations that inform our audience and reward our shareholders.”

Mr. Ailes received an exit package worth more than $40 million, according to a person familiar with the matter. Mr. Murdoch took over as chief executive of Fox News.

Fox ultimately settled the suit by Ms. Carlson for about $20 million. But the scandal continued to reverberate. There were revelations of earlier, previously undisclosed settlements paid to other women who alleged they were harassed by Mr. Ailes. And 21st Century Fox reached settlements with some new complainants.

Critics argued that Mr. Ailes had fostered a workplace that was hostile to women, where harassment was tolerated. Earlier this year, a New York Times investigation revealed that Fox and Mr. O’Reilly had reached previously undisclosed settlements with multiple women who had alleged the prime-time star harassed them. He denied the allegations and departed Fox News.

The U.S. Attorney for the Southern District of New York launched a probe examining how 21st Century Fox made and disclosed settlement payments. That investigation is ongoing. 21st Century said it was cooperating with the probe. Mr. Ailes hadn’t been interviewed by investigators before his death, according to a person familiar with the matter.

Write to Joe Flint at joe.flint@wsj.com