When Michael Bloomberg returns to Bloomberg LP after Jan. 1, he’ll find an enterprise that has thrived in his absence. Revenues at the data and media powerhouse that he founded have tripled during his 12 years as mayor of New York City. Last year it moved ahead of archrival Thomson Reuters to become the largest financial data provider on earth. Bloomberg is on track for record revenues of $8.3 billion in 2013 and profits of about $2.7 billion, according to Douglas Taylor of Burton-Taylor International Consulting.

By any measure Bloomberg is a staggering success. And yet there’s a palpable sense of anxiety inside its gleaming Manhattan headquarters tower. After three decades of full-throttle ascent, sales of its data terminals have flattened, and an organization that has never known anything but maximum velocity is now grappling with what it means to face limits.

The result is a traumatic identity crisis. This is a story about a company that has been so successful with one product — and with its uniquely dysfunctional way of doing things — that it has resisted attempts to prepare for the future or modify its methods. Those tensions have emerged in attempts by CEO Dan Doctoroff, who arrived in 2008, to diversify the business and impose professional order on a chaotic enterprise where screaming and infighting have long passed for management. (Says a former high-level company executive of Mike, as he’s known inside Bloomberg and as we’ll refer to him to avoid confusion: “Mike’s management philosophy is five cats in a bag fighting.”)

Doctoroff has recharted Bloomberg’s strategy. The terminal has always been the company’s alpha and omega, a totem fetishized and worshipped, the source of 85% of its revenue — and virtually all its profits. Almost any spending on ancillary businesses could be justified in the vague but potent name of selling terminals. Doctoroff has endeavored to introduce a discipline that would seem rudimentary in most companies but has been treated as heresy inside Bloomberg. His wild idea? Businesses other than the terminal need to make money.

But as we’ll see, even when Doctoroff has had the explicit backing of Mike — and the mayor speaks to the CEO every week, according to Doctoroff — he has been subverted by internal resistance and the occasional stumble. As a result, Bloomberg has sunk more than $2 billion into its diversification efforts with little to show for it so far.

That’s just the beginning of the recent travails, interviews with 82 current and former Bloomberg executives and journalists reveal. Its giant news service is in retreat from a once-proclaimed goal to become “the world’s most influential news organization.” Its reputation has been sullied by two episodes that raise questions about Bloomberg’s dysfunction and ethics. In one, its reporters acknowledged using the terminal to snoop on customers; in the second, the news division was accused of canceling an article about a Chinese billionaire to avoid antagonizing authorities, a charge the company disputes. (Fortune, it should be noted, is a competitor of Bloomberg News and its magazines. The chief content officer of Time Inc., Fortune’s parent, is Norman Pearlstine, who returned to Time Inc. in November after five years at Bloomberg. At that point Pearlstine recused himself from any involvement with this article. For more, see Editor’s Desk.)

As if there weren’t enough roiling the company, it will have to contend with the return early next year of its 71-year-old founder, who owns 85% of the business. Mike’s mayoralty will conclude when the clock strikes 12 on New Year’s Eve, and he’ll have a desk back at company headquarters. He insists he’s not going to run the business, and he appears uncertain about his future. Whatever his role, Mike — who is now worth a jaw-dropping $31 billion, according to Forbes — will probably focus more on boosting his influence than on making money.

It all makes for a management nightmare for Doctoroff, whose power is hemmed in from every side. He has been forced to operate like a prime minister in a coalition government, pleading for consensus from powerful ministers — such as combustible news head Matt Winkler and terminal boss Tom Secunda — who control resources and decide whether they’ll allow anything to get done.

In lengthy conversations with Fortune, Doctoroff describes his relationship with Mike as “spectacular” and professes to look forward to his return. As Doctoroff puts it, “We’ve been overwhelmingly in sync on everything.” (Mike declined requests for an interview.) But beneath his self-assurance and the organization’s bluster is a vulnerability both profound and unspoken: Bloomberg’s epic multidecade run — the equivalent of a few centuries in the fast-moving technology sphere — has rested on a single product. What if another company invents a better terminal? It seems improbable. Yet the proof that it can happen is embedded in Bloomberg’s very existence: It, too, was once the upstart that toppled a seemingly invincible titan.

Dan Doctoroff displays a toy near his spotless desk on the open floor of Bloomberg’s headquarters (not even the CEO has a private office). It’s a plastic model of the solar system, with tiny colored planets orbiting a giant sun. Atop the sun is a small icon with two flat screens — a Bloomberg terminal in miniature. Doctoroff has steered the company into costly new ventures (those tiny planets). But the terminal remains the center of the Bloomberg universe — “the giver of life,” he calls it. He’s astute enough to know he must pay homage.

Doctoroff, 55, has experience grappling with tribal politics. A graduate of Harvard and the University of Chicago Law School, he made a fortune running private equity firm Oak Hill Capital. Doctoroff then served for six years as deputy mayor under Mike. His ambitious plans to remake New York after 9/11 provoked comparisons to the city’s controversial 20th-century master builder, Robert Moses.

Tall and curly-haired, with considerable charm and a passion for metrics, Doctoroff can tell you precisely how many meetings he held last quarter (727). During his time at City Hall, where he sat back to back with the mayor, he says, they discussed the company for a total of perhaps one hour before Mike asked him to run it. Hizzoner’s invocation when Doctoroff left for Bloomberg: “Don’t fuck it up.”

Bloomberg’s creation story is well known. A former trader and IT chief fired from Salomon Brothers in 1981, Mike used his $10 million severance, with Secunda and a few friends, to build a machine that reported and analyzed bond data. Over the years they added oceans of information and analytical tools on stocks, commodities, energy, options, real estate, currencies — you name it. When Bloomberg started, it was an ant compared to the established players. By 1996 it had reached No. 2.

Bloomberg has prospered on the back of this single remarkable product. Once delivered to traders through a desktop terminal, it’s still referred to as a “terminal” (or “the Bloomberg”) even though it arrives today, to 318,000 customers, via the Internet. It retains a 1980s-style, command-driven interface, making it difficult to learn and clunky-looking. But it’s lightning fast, and it now has 15,000 functions, covering everything from SEC filings to golf scores to horoscopes. (The average customer uses 29, according to a 2010 company analysis.)

A single terminal subscription costs $24,000 a year. Those with two or more pay $21,000 for each; there’s no additional discounting, even for giant customers that have thousands. Unlike its competitors — such as Thomson Reuters and (far behind it) S&P Capital IQ — Bloomberg has never offered cheaper, à la carte purchase options.

The company touts the terminal as a Stradivarius for the beautiful music of making money, and as a status symbol. It has a system — first offered in 1991, before most people had email — that allows Bloomberg customers to send electronic messages to one another. That system provided entrée to an exclusive Wall Street social network, making the Bloomberg even more addictive.

Under Mike, the company flourished with a hard-driving, macho sales culture. Bells rang when terminals sold. The hours were long, the pay and perks generous. To Mike, loyalty was paramount. The company never laid anyone off. But people who defected to a rival were escorted out and never allowed back. As he saw it, they were “traitors,” trying “to take the food from our children’s mouths.”

Part of the package was delivering market news that could make traders money. At first Mike bought rights to offer the Dow Jones newswire. But since that company also owned Telerate, then the biggest data provider, Mike feared the day when his giant rival would wise up and cut him off. In the late 1980s he decided to go into the news business.

The terminal and Matt Winkler were made for each other. It’s not just that, as he puts it, “I can’t imagine my life without a Bloomberg terminal.” Or that, as a person who fixates on details and numbers, he reveres its endless data. More than that, Winkler exhibits the sort of binary thinking you’d expect from a computer. He craves and perpetuates rules and seems to lack an ability to distinguish among levels of transgression when they’re broken. You get the impression that if he could replace his staff with a team of robo-journalists, he’d do it in a second.

Winkler, 58, has a reputation as a sort of adulte terrible, known in business journalism circles for his volcanic temper and his fondness for bow ties. He’s third-generation Wall Street: His grandfather founded a brokerage firm; his dad was a stockbroker. Winkler was a 34-year-old bond reporter for the Wall Street Journal when Bloomberg recruited him in 1990 to start a financial newswire.

Winkler’s achievements are considerable. He has built a formidable operation that goes toe to toe with the Journal on breaking business news. Today, with 2,400 journalists operating from 150 bureaus in 73 countries (the company has 15,500 employees overall), Bloomberg ranks as the third-largest independent news organization on the planet. Only Reuters and the Associated Press are bigger.

But Bloomberg News is fundamentally different from other media organizations. It wasn’t even designed to generate income. It was created to help the company sell more terminals by furthering the moneymaking goals of those who lease them. (Customers’ average income: $438,000.)

Winkler embraces the mission, telling his team that they write for “the people with the most at stake.” Bill McQuillen, a reporter who left in 2012, puts it another way: “I used to say my job at Bloomberg was to help rich people get richer.”

To be sure, there’s tension between business and journalism in every media organization. What’s unusual about Bloomberg is the alliance that has existed from the outset. In his autobiography, Bloomberg by Bloomberg (whose cover cites Winkler’s “invaluable help”), Mike recalls spelling out the role of news in the Bloomberg universe on Winkler’s first day of work. “Our purpose was to do more than just collect and relay news; it should also, ethically, advertise the analytical and computational powers of the Bloomberg terminal by highlighting its capabilities in each news story. This would make each story better and, at the same time, make it easier to rent more terminals …” He continued, “Most news organizations never connect reporters and commerce. At Bloomberg, they’re as close to seamless as it can get.” The company instructs bureau chiefs to visit customers weekly; journalists regularly go along on sales calls. Over 23 years Winkler has built and enforced this system. Throughout he has been a fearsome defender of Mike and has been repaid with unstinting loyalty in return.

Winkler spells out his philosophy in his 376-page guidebook, The Bloomberg Way. It contains dictates for everything from his ingredients for a four-paragraph lead (“a structure as immutable as the rules that govern sonnets and symphonies”) to rewriting press releases (“the bread and butter of financial news organizations”). Winkler scorns writerly characterizations as offering “subjective judgments we shouldn’t make.” He rejects adjectives and adverbs as “imprecise” and bans some words and phrases, including “but” (the latter on the grounds that having to process contradictory ideas close together confuses readers).

He has a distinctive approach to headlines. They should always deliver surprise, which he defines as “a combination of words [readers] can’t remember seeing before.” At Bloomberg, where Winkler still writes many headlines himself, this often produced head-scratchers, such as: “Mizuho $7 Billion Loss Turned on Toxic Aardvark Made in America.” The phrases spawned a Tumblr blog called strangebloombergheadlines.

Winkler polices his empire tirelessly — he rises at 4 a.m. and reads 150 articles a day — wielding the Bloomberg Way like a hellfire-and-brimstone preacher clutching the Good Book. In calls, in person, and in “Matt’s Notes,” a weekly internal newsletter, he bludgeons anyone he catches violating its smallest dictate. He’s been known to call reporters in the middle of the night, demanding a response to a competitor’s scoop or an explanation for some offense buried deep in a story: “Why is there an adjective there?”

Winkler’s temper has long been an occupational hazard at Bloomberg News. He’ll explode in red-faced rages, which some reporters call “seizures.” It might be for a serious screwup; Winkler has a sharp eye for holes in a story. But something trivial can trigger an eruption, often in public and humiliating: “How stupid are you?”

His outbursts are so infamous that the gossip website Gawker has a page largely devoted to them. It includes an audiotape of Winkler screaming at a female editor who was trying to explain away the mistake of a reporter he’d fired. “The enemy that day was the computer,” she tells Winkler.

“Wrong!” Winkler explodes. “It’s not the computer! It’s not the computer! It’s the HUMAN!”

Being a journalist at Bloomberg was “infantilizing,” says Tony Spaeth, a Hong Kong-based editor for Bloomberg who left in 2008. “It’s like having two hands tied to your ankles.” Even halfway around the world, he says, everyone lived in “weird fear” of Winkler’s wrath.

Employees mostly endured the abuse. But now and again there’d be signs of subversion or resistance. After being fired in 1994, a reporter in London snuck back into the empty newsroom at night and posted a “red” headline alert on the terminal: WINKLER WANKER WINKLER WANKER. Bloomberg responded by pressing charges under a British computer-misuse law. (Winkler’s two sons engaged in their own form of rebellion. Both shed their secular brand of Judaism in favor of orthodoxy and found wives through a matchmaker. His oldest, Jacob Max Winkler, now has a website, glorytothehighest.com, where he has promoted himself as “Shaman and Spiritual Advisor for Those With the Most at Stake.”)

During an hourlong interview, Winkler repeatedly declined to describe his temper as a problem, noting that many employees have remained happily at Bloomberg News for years. A day later he sent me an email: “While I can’t please everybody and you can always find people who will criticize you, I’m passionate about news, and yes, at times I’ve lost my cool in the context of trying to get things right. Any other suggestion isn’t true.”

Winkler’s rages meant that for years word would be passed, in newsroom code, that “the bow tie is spinning.” That has been upgraded to a more formalized early-warning and mitigation system. Senior executives — including Doctoroff — have worked to head off outbursts. “There were a lot of people who put their foot down to be sure [Matt] was isolated when he was having a bad day,” says former HR chief Melinda Wolfe, who left in September for a similar role at Pearson. She says she sought to be ” really proactive … If someone was worried or if Matt looked agitated, I would make sure I kept an eye on things. Dan spoke to him a lot, and I do think he made progress. But he made progress because he made the effort, and he was surrounded by resources that helped him create stability.”

For a long time at Bloomberg News, anything seemed possible. Just as Mike had envisioned, the news budget soared with the growth in terminals. As print publications slashed staff, Bloomberg kept hiring, collecting big names from places like the Wall Street Journal and the New York Times — unthinkable just a few years earlier.

In a heady moment around 2009, executives began declaring their ambition to make Bloomberg “the world’s most influential news organization.” Winkler extended coverage to nonfinancial topics such as sports, culture, and tech gadgets. Bloomberg teams began long investigations bent on making waves and winning prizes — especially a Pulitzer, which has so far eluded Winkler’s grasp.

There was always a frustrating reality for reporters: They worked for a giant global news organization, but few people read their work. Says Janine Zacharia, who covered the State Department for four years until 2009: “Sometimes you’d be sad if you only got seven hits on a story.”

Bloomberg News’ real focus is speedy and “actionable” market news, aimed at giving subscribers a split-second trading edge. Of the 5,000 dispatches it spits out daily, the vast majority amount to rapid-fire digests of press releases, SEC filings, and government announcements. Some don’t even require humans — they’re auto-generated by computer algorithms that scrape details from PR wires and reports. More still are “flashes” produced by hyperkinetic (human) specialists manning the company’s “speed desk.” The fastest can generate a headline from an incoming release in “a shade under 4.5 seconds,” says executive editor Kevin Reynolds, who built the operation.

In 2010, Reynolds launched First Word, which boils market news down to a few bullet points, so frantic traders don’t have to read entire articles. This new product has been wildly successful, typically drawing more than half the terminal page views generated by all of Bloomberg News.

When Dan Doctoroff landed at Bloomberg in January 2008, he showed every sign of taking charge. But he quickly learned that the raucous culture makes it hard for any leader — particularly a newcomer — to wield power. As he puts it, “There’s much more collaboration that’s required here. In order to get things done with speed, you have to work with people from a lot of different groups.” Doctoroff would find that certain groups — and individuals — could prove very recalcitrant indeed.

At the outset he plunged into data-gathering, meeting with 300 employees and 200 customers, and hiring McKinsey consultants. He wanted to transform the company into a rational modern business and create profitable new ventures that would diversify it beyond the terminal.

In July 2008, Doctoroff announced his bid to whip Bloomberg into shape. Before a companywide gathering with skits and a marching band — to the Beatles song “Revolution” — he unveiled “Plan B.” It included 47 initiatives. It split Bloomberg into separate units, each with its own chief and sales force; shuffled the jobs of 42 top managers; and established a formal strategic-planning process. Doctoroff announced he would consider major acquisitions.

Much of that was apostasy at Bloomberg, which treated its founder’s views as gospel. “People live there in the shadow of Mike,” says former HR chief Wolfe. “There’s a constant questioning: What would Mike do?” Mike had always believed in a single, unified business. Mike didn’t care for strategic planning, diversification, or acquisitions. And Mike didn’t think much of consultants: “Generally speaking,” he said in a 1998 interview, “our experience is they ain’t as smart as they think they are.”

But Doctoroff wrapped his plan with a giant sweetener: If Bloomberg, which then had $6.1 billion in revenues, reached $10 billion by 2013, everyone in the company would get a bonus equaling 70% of their annual pay.

It was a hugely ambitious goal. The timing, of course, couldn’t have been worse: The Wall Street meltdown was already under way. In 2009, for the first time, Bloomberg ended the year with fewer terminals rented than the year before. Although price hikes kept revenues rising, the $10 billion goal was far beyond reach.

Still, Doctoroff charged forward — “Our whole strategy is to invest countercyclically,” he says — remaking existing businesses while pouring money into others. Since he took over, Bloomberg’s headcount has grown by more than 50%.

Officially the company was Doctoroff’s to run. Mike agreed with a city ethics board that he’d have no involvement in Bloomberg’s day-to-day operations, limiting his input to major decisions that “significantly” affect his ownership stake. “I’ve recused myself from anything to do with the company,” Mike said at a press conference in November.

In truth, Mike was considerably more involved than that statement would suggest. He monitored the business from his Bloomberg terminal at City Hall and, as noted, spoke to Doctoroff every week. On occasion — including twice in one week as New York grappled with a blizzard dubbed “snowpocalypse” in February 2010 — Mike turned up at Bloomberg headquarters after-hours for meetings. (One of those sessions, during the blizzard week, concerned a redesign of Bloomberg’s website.) In other cases, he was briefed down at City Hall. Mike stayed on top of what was happening at his company, but he didn’t want to act as the decider after he left. And so a series of internal struggles played out, with Bloomberg playing only an occasional, oblique role.

Early on Doctoroff hired Pearlstine, formerly the top editor at Time Inc. and the Wall Street Journal, as chief content officer, reporting directly to him. That gave Bloomberg a senior editorial figure poised as a credible alternative to Winkler. For his part, Winkler, who craves respect for his operation, relished the symbolism of a former Journal executive editor (who had hired Winkler at that paper) coming to Bloomberg.

Pearlstine’s arrival spurred talk that Winkler’s days were numbered. As part of Plan B, he had already lost control of Bloomberg’s TV, radio, and web operations. Two months later he announced he’d be pulling back from day-to-day news meetings and story editing to focus on “the big picture” and training. Pearlstine figured prominently in a December 2008 Vanity Fair article that read like Winkler’s obituary. It appeared, the article stated, that Winkler was “being written out of his own masterpiece.”

But in the course of a weekend in May 2009, that was suddenly reversed. Mike Bloomberg and Winkler were both in Washington for the annual White House Correspondents’ Dinner. People familiar with the situation say Mike told Winkler he believed in him; he wasn’t going to let anyone push him out. (Winkler comments: “I never had a discussion at any WHCD with Mike Bloomberg about anyone’s role at Bloomberg.”) “Rather than stepping back, he stepped up even more,” says Ed Chen, Bloomberg’s White House correspondent at the time. That ended talk of Winkler’s imminent demise.

No longer viewed as Winkler’s potential replacement, Pearlstine increasingly was thrown into the role of trying to smooth over the conflicts the editor-in-chief left in his wake. Some started to call him “the Matt whisperer.”

About that time, the mayor tossed a grenade into Doctoroff’s plans to establish a bottom-line sensibility: He decided to buy BusinessWeek. Doctoroff, company chairman Peter Grauer, and Pearlstine all opposed the idea, viewing the magazine, headed for a $62 million loss in 2009, as a money pit. But Mike relished getting his hands on a big consumer publication, circulating 900,000 copies a week. It would extend his influence, and, at $5 million, he could pick it up for a song. Bloomberg hired a dynamic young editor, Josh Tyrangiel, to take charge, and the rebranded Bloomberg Businessweek has emerged as better and buzzier. But it continues to lose about $30 million a year.

In 2011 the mayor launched a second venture aimed at amplifying his voice: Bloomberg View, an online opinion page featuring editorials and marquee columnists. An open checkbook attracted a roster of stars, including Michael Lewis and Jeffrey Goldberg. Michael Kinsley, who recently left, says Bloomberg paid him twice what he’s now making at the New Republic. He adds, “It’s probably what a journalist could have made at the peak of the golden age.”

In Doctoroff’s crusade to make sense of Bloomberg’s operations, its TV business was a natural target. It lost $196 million in 2008. Its screen was cluttered with info boxes and stock tickers, and its programs had all the panache of C-SPAN. In addition to the U.S. broadcast, Bloomberg operated six foreign-language channels. Each drew a meager audience. The company justified the losses as helping to market terminals and boosting access to newsmakers.

“It was not rational,” says former NBC News chief Andy Lack, another high-profile Doctoroff hire, who arrived in 2008 to fix the multimedia operations. “The cost made no sense and had no revenue against it to speak of. They were spending a lot of money that wasn’t bringing them additional influence or a better-quality product.”

Eager to shake things up, Lack contemplated launching an evening comedy program, to be called None of Your Business. A co-creator of the Daily Show made a 22-minute pilot during the summer of 2010. The pilot featured a former Miss USA as co-host and a stock-picking tarantula named Ivan. Lack quickly pulled the plug.

In 2009 he shut down the foreign-language channels, firing about 140 staffers, in the first layoffs in Bloomberg’s history. To run U.S. television he hired a young Fox News executive named David Rhodes. Bloomberg TV quickly became more watchable, with new on-air talent, better visuals, and a fresh program lineup. But the TV team soon ran afoul of Winkler. Even though TV was no longer officially under his control, he wasn’t about to give up that role. Winkler battered the new TV managers with complaints that their efforts to brighten the broadcast violated the Bloomberg Way. The criticism ranged from the selection of guests to onscreen punctuation.

In mid-2010, “Matt’s Notes” blasted Bloomberg TV. “Readers, listeners and viewers rely on Bloomberg News to give them facts, not glib labels, clichés or gossip,” he wrote. A teaser referring to Japanese politician Naoto Kan as “Kan the Man” was “puerile, obscure and uninformative.” Bloomberg TV producers had “compromised our integrity” with real-time tweets from a congressional hearing on Goldman Sachs. One tweet observed that CEO Lloyd Blankfein was “working hard not to start the head-bobbing thing.” Such messages, Winkler wrote, were “assertion/opinion and therefore inaccurate.” After two years of Winkler’s meddling, Rhodes left in 2011 to become president of CBS News. His replacement has since departed too.

Bloomberg is still losing $100 million a year on TV. The business has shifted strategies, abandoning the hopeless TV ratings race to redefine itself as a producer of digital video for Bloomberg’s websites, tablets, and smartphones. Shepherding this approach is Justin Smith, hired from Atlantic Media. Lack, who’s been bumped upstairs to chairman, says he doesn’t even like to talk about TV anymore: “The future is on those platforms.”

Doctoroff’s attempts to change Bloomberg often met resistance from Tom Secunda, the company’s co-founder and head of its terminal business. He was every bit as ferocious as Winkler when it came to protecting his domain and the company’s long-established ways. More than a few people view Secunda, a gruff 59-year-old trained as a mathematician, as the mad genius behind the terminal, a wizard at connecting the worlds of technology and finance. Secunda is worth $1.5 billion, mostly due to his equity in the company, according to Forbes.

Secunda opposes anything he thinks might cannibalize or compete with the terminal business and disagrees that the company needs to diversify. “I’m a contrarian on this,” he says. “There’s a million — or 2 million — people that can buy a Bloomberg terminal. We know who they are.”

Secunda identifies with the terminal so completely that he sometimes speaks of it in the first person. To wit: “There are certainly places where I can still be a more important product, where I can still make my product more valuable so that people buy me.” When Bloomberg does start new ventures, Secunda has been loath to permit anything that varies from its historical business model.

The first such effort came in a venture called Bloomberg Law, which aimed to do for attorneys what the terminal does for Wall Street traders. That wasn’t nearly as easy as it sounds. The legal-research market has two dominant, entrenched players: Westlaw, owned by Thomson Reuters, and LexisNexis, a division of Reed Elsevier. Both have databases of statutes, case law, court dockets, legal articles, and other materials built up over decades. That would be exceedingly difficult and expensive to match.

But who better suited to do that than Bloomberg? Mike himself promoted the idea even before he left for City Hall in 2002. Still, his successors were terrified that offering any kind of data on a different, cheaper platform would make their cash cow less unique and desirable. They decided that BLAW, as they called it, would be available only as part of a terminal subscription. To get Bloomberg’s untested new legal product, customers had to pay $18,000 a year for a Wall Street data service — most of which the average law firm didn’t want. By contrast, Westlaw and Lexis offer a more appealing model for law firms: They charge for each search, making it easier to pass the cost on to their clients.

Sure enough, BLAW’s debut was a flop. In 2006, Bloomberg set up sales teams around the world, with a goal of selling 3,000 terminal subscriptions to law firms. Instead they sold about 300, says a person involved in the project.

When Doctoroff arrived in 2008, he quickly approved offering BLAW on a separate website — a first for Bloomberg. But years of high-level debate about the strategy dragged on. McKinsey was hired to study pricing options. Secunda grumbled about how much Bloomberg was spending to break into the new market in a big way, rather than targeting a small niche. “You guys are trying to boil the ocean,” he complained.

Bloomberg kept tripping up. It initially built the BLAW website on a Flash software platform, which crashed computers and didn’t work well on mobile devices, forcing the company to rebuild it on a new platform. Worried about lawyers sharing passwords, BLAW required them to use a fingerprint reader, just like terminal customers. Lawyers hated it, and the idea was dropped.

Secunda had insisted that anything with the Bloomberg name be sold as a flat-fee “premium” product to avoid damaging its brand. So the new web version of BLAW carried a public sticker price of $5,400 a year — a lot less than the terminal, but still pricey for such a product — while also privately offering discounts to many firms.

For the 2009 relaunch of BLAW as a website, Bloomberg once again aimed for 3,000 subscribers — and once again fell short: 1,000 this time. BLAW is now generating yearly revenue of about $20 million. Since the beginning of 2010, it has had three CEOs. Over a decade, BLAW has cost Bloomberg about $1 billion. Inside the company some refer to it as “Bloomberg’s Vietnam.”

In September 2011, Doctoroff doubled down, buying the Bureau of National Affairs, which publishes newsletters and reports on business, law, and government, for $992 million. A big reason for the purchase was to serve as a sort of “accelerator” for BLAW. This year Doctoroff announced that he is consolidating BLAW with BNA, resulting in the loss of 80 jobs. In the meantime, BLAW has gained market share, though it remains far behind Lexis and Westlaw. According to Doctoroff, the business is now “modestly” short of Bloomberg’s latest expectations.

But it isn’t likely to make money anytime soon. “The beauty of our company,” chairman Grauer observes, “is that as a private business with essentially one shareholder, we can take a very long-term view about these opportunities,” tolerating a “slow ramp-up to profitability.” How long term? “The way we look at things,” he says, it’s “10 to 15 years.”

Even as BLAW struggled, Doctoroff was preparing a second, equally ambitious attempt to replicate the terminal’s success. Bloomberg Government, or BGOV, was aimed at providing news and data for anyone with business in Washington — while hoping to avoid BLAW’s problems by maintaining distance from the Bloomberg mothership.

BGOV was conceived as a nimble startup that could operate independently. Its head was former McKinsey partner Chris Walters, Doctoroff’s internal strategy chief. Since it was focused on government, not Wall Street, BGOV would be based in Washington rather than New York. It would be offered on its own website, not the terminal, and use separate email and customer-relations-management systems. BGOV was even to have its own staff of 150 journalists and policy wonks — separate from the Bloomberg News operation — to write articles, reports, and analyses.

Priced at $5,700 per year, BGOV took aim at such well-established rivals as Congressional Quarterly and National Journal, budgeting up to $100 million for the first 18 months. Bloomberg’s swagger, and the massive sum it was investing in a media startup, would prompt Washingtonian magazine to dub it “Bloomberg’s Death Star.”

BGOV quickly collided with Winkler. He wasn’t about to countenance an operation that he couldn’t control involving journalists. Never mind that the reporters were on BGOV’s payroll. He insisted that News approve every hire — and that each report to Winkler’s own Washington editors.

Next Winkler began criticizing BGOV’s content, insisting that its stories — aimed at a Washington audience — follow the strictures of the Bloomberg Way. After BGOV’s launch in January 2011, he began holding daily 2 p.m. headline clinics by conference call. BGOV’s veteran editors would gather and roll their eyes as Winkler, on the line from New York, tore apart each headline and made them rewrite it in Bloomberg-ese. “You could hear his screams,” recalls one attendee: “What’s the surprise? I don’t know what the surprise is!” He went so far as to prohibit use of the standard policy term “white paper.”

Internal critics derided Walters and his deputy as “the McKinsey boys,” blasting them as callow consultants with no appreciation for Bloomberg’s methods. Secunda failed to provide engineering support BGOV needed to make its site even close to fully functional on the promised schedule.

By late 2011, BGOV was far behind its lofty projections of 5,400 subscriptions. It had sold fewer than 2,000. Now BGOV’s executives, who viewed Winkler and Secunda as undercutting the project, would have to explain themselves in a company budget meeting — to Secunda and Winkler, among others. Sure enough, in front of some 50 people, Secunda tore into Walters. Why did you spend so much on the launch? Why didn’t you start small? That’s how we built Bloomberg!

As Doctoroff looked on uncomfortably, Walters tried to placate the old guard for two hours. He admitted being too optimistic in his forecasts and said he had learned from his errors. Walters proposed trimming BGOV’s budget by laying off journalists (whose oversight he had lost to Winkler). That comment only set off Winkler, who exploded: We’ve never talked about these cuts! How can you cut journalists without talking to me?

Battered, Walters left a few months later to become COO of the Weather Channel Cos. BGOV’s budget was cut. Some 40 staffers were laid off, and the operation was brought back under New York’s control.

Today BGOV’s business is inching upward. It has about 4,200 subscribers, still well below its original 2011 target. Doctoroff puts the cumulative losses at “less than $200 million.” People familiar with the situation say BGOV is now on a trajectory to break even on an operating basis — by 2018. When it might be able to pay back the initial investment is anybody’s guess. But more important, BGOV is now being run the Bloomberg Way.

The scandal that rattled the Bloomberg empire in 2013 began with an alarm two years earlier. On Sept. 15, 2011, the financial press was buzzing about a rogue UBS trader who had racked up a multibillion-dollar loss. At 7:29 a.m., Bloomberg TV anchor Erik Schatzker went on the air and noted a special advantage enjoyed by his organization. “We have been using the Bloomberg terminal, one of the unique tools that we have at our disposal, to find out a little bit about [the trader],” he explained. A recent log-in by the trader suggested that perhaps UBS “did not know about this trading loss until very recently.”

The inadvertent confession attracted no outside attention (perhaps because it occurred on the little-watched Bloomberg network). Schatzker was immediately reprimanded — for revealing the practice, not for engaging in it. Indeed, it was a routine part of the Bloomberg Way. The company had always given reporters access to data showing when users had last logged on, what terminal functions they used most, even transcripts of their chats with the Bloomberg customer help desk. It was just one piece of the perpetual sales effort, in which journalists were viewed as partners. Bloomberg’s sales reps had even more data. It allowed them to study customers’ usage, then meet with them to point out unused functions that might make the terminal more indispensable. “The level of information about customers is mind-boggling,” says a former senior sales rep.

After the on-air disclosure in 2011, Doctoroff convened a senior management meeting. He ordered that journalists’ access to customer data be shut down immediately. But as would later become clear, no one carried out the order.

The problem reemerged in the spring of 2013. A Hong Kong reporter was chasing a scooplet about a departing Goldman Sachs partner. She called Goldman’s local PR officer on April 16 to verify the tidbit. When the press rep declined to confirm the departure, she informed the rep that her terminal revealed that the partner hadn’t logged on to his Bloomberg for two weeks. News of the exchange quickly reached Goldman headquarters in Manhattan, where PR chief Jake Siewert began quizzing Bloomberg reporters he knew. He also called his counterpart at J.P. Morgan Chase; as it turned out, J.P. Morgan had fielded similarly prescient queries from Bloomberg reporters.

Both banks harbored assorted resentments toward Bloomberg, starting with its lofty prices. (Goldman’s annual bill is about $100 million.) At an April 29 meeting with Goldman, Doctoroff confirmed that for years Bloomberg reporters had special access to customer data. Doctoroff assured Goldman president Gary Cohn that reporters’ access had been terminated, and promised to gather more information. He hoped that would be the end of it.

It wasn’t. The New York Post broke the story 11 days later with the headline GOLDMAN OUTS BLOOMBERG SNOOPS. Bloomberg’s customers were livid. They demanded answers: Exactly what customer secrets had reporters seen? The company had a crisis on its hands.

Doctoroff shifted into damage-control mode. He contacted hundreds of customers, assuring them that what mattered most — their trading secrets — had never been monitored. He commissioned not one but two reviews of Bloomberg’s practices. The first, conducted by an outside law firm and a consulting group, focused on the snooping. It concluded that Bloomberg now had “appropriate” privacy controls in place — and that reporters never gained access to sensitive trading, portfolio, or messaging data. The 102-page report blamed the failure to follow Doctoroff’s 2011 instructions on “misunderstandings” but offered no details about who failed to act or why no one made sure that reporters could no longer gain access to customer data.

Doctoroff also commissioned a second review that examined Bloomberg News’ practices — essentially an examination of Winkler’s methods. It was conducted by Clark Hoyt, a respected Bloomberg editor and a former ombudsman at the New York Times. At the Times, no one but a copyeditor saw his critiques before they appeared in print. In contrast, his Bloomberg report was delivered first to management for consideration of what to make public.

In some ways, the public report was remarkable for Bloomberg. It offered an array of criticisms. Hoyt urged steps to separate the company’s business from its journalism. He criticized the “tonality” of Winkler-style headlines. He urged increased ethics training. The company says it has begun implementing the recommendations.

But the tone of what Bloomberg released publicly — which it refers to as a summary — differed conspicuously from Hoyt’s detailed, warts-and-all appraisals at the Times. The culpable were not identified, and key details were lacking. An organization that excoriates reporters for grammatical errors would not identify those responsible for policies that allowed employees to spy on customers.

Whatever their merits, the two reports paid off for Bloomberg. Customers seemed appeased; the storm had passed. For his part, Winkler appeared unscathed. In a May 12 column on Bloomberg’s website headlined HOLDING OURSELVES ACCOUNTABLE, he apologized for the “error,” but minimized its significance and said nothing about his own knowledge or accountability. In an interview with Fortune, Winkler repeatedly dodged the question of his own role, saying, “The permissioning of it didn’t come from Bloomberg News,” and “the access to the function was not determined by anybody in News, ever.” At the end of the interview Winkler finally stated it flat out: He had known about it for years.

Bloomberg’s journalism has attracted notice of late, but not in a good way. Last month — a year after a tough series on the Chinese government won plaudits — Bloomberg reporters anonymously told the New York Times that Winkler had abruptly canceled a nearly yearlong investigative project out of fear that it would infuriate the Chinese government. Winkler publicly insisted the project was merely delayed because it was “not ready.” Leaked internal emails in which two senior Bloomberg editors praised the China work as “terrific” and “almost there” then appeared in the media. According to the press accounts, Winkler justified his decision by comparing it to self-censorship in Nazi-era Germany, saying it would allow Bloomberg to continue to report on China by avoiding expulsion.

The episode cemented the impression that the terminal remained king and that journalism would be sacrificed if it threatened the business. Soon after, Mike Forsythe, the project’s award-winning lead reporter and suspected leaker, departed suddenly, prompting fury among Bloomberg alumni. “I am ashamed of my alma mater,” former White House reporter Dick Keil posted on Facebook. Other alums expressed similar sentiments.

Meanwhile, in the last days of November the company’s news bureaus in Shanghai and Beijing received unscheduled “inspections” by Chinese regulators, at least one of whom requested that Winkler apologize for his Nazi comparison. (A Bloomberg spokesperson declines to comment.)

All this occurred just as the first-ever layoffs at Bloomberg News were announced. The number is relatively small — 35 — but it was startling in an organization that seemed to have no limits. The ax fell in the realms of sports, the arts, and investigative reporting, all elements of the plan to become “the world’s most influential news organization.” Bloomberg’s scaled-back ambition: to become “the world’s most influential business and financial news organization.”

Doctoroff has already abandoned two of his ventures: a real estate unit and a personal-finance website. He seems ready to cut his losses in two more: BGOV and Bloomberg New Energy Finance, a data provider on the clean-energy industry. The company is pondering merging one or both with BNA. Either move would surely involve more job cuts.

Indeed, all the units that have been the source of so much investment, conflict, and attention — TV, news, BGOV, and BLAW — are now expected to generate less than 5% of company revenues. So far rivals have not shown an ability to take advantage of Bloomberg’s missteps; the company has continued to eke out additional market share even as its terminal sales have slowed to 1% annual growth the past two years. But Bloomberg faces the same threats as every other tech company: ever more options, many of them low-cost, for its customers. It also faces some less common threats: Some eight major Wall Street firms — customers — are collaborating on an instant-messaging system that could compete with the terminal’s popular IM system and thus reduce its allure.

There’s one area of good news: success in a business line that comes closest to Bloomberg’s original mission — providing technology services to the financial industry. The “enterprise business” seeks to exploit Bloomberg’s tech muscle and Wall Street presence to offer such products as portfolio risk analytics, order management systems, and message storage and retrieval. Just three years old as a separate entity, it’s growing at a 16% clip, with projected 2013 revenues of nearly $1 billion, according to Doctoroff.

The CEO shows signs of slowly consolidating power, and the organization is restraining its spending for the first time. But that could quickly go out the window in the face of the ultimate X factor: Mike’s reappearance, unfettered by any mayoral restrictions, in January. Inside the company, contradictory rumors swirl. They predict everything from layoffs in the company’s unprofitable TV and magazines units to the acquisition of the New York Times Co. Whatever happens, entropy will likely reign. It seems Mike wouldn’t have it any other way.

Reporter associate: Marty Jones

This story is from the December 23, 2013 issue of Fortune.