“I ’m leaving the company in two weeks,” Dick Costolo said abruptly, his face stricken, his fingers banging the wood-slab table before him. Costolo, the bald and lithe chief executive of Twitter, was sitting in the Waterthrush conference room on the 11th floor of his company’s headquarters, in the old Western Furniture Exchange and Merchandise Mart, in downtown San Francisco. As the words left his mouth, Costolo’s nine top lieutenants, his so-called Operating Committee, looked up from their iPads and smartphones, stupefied. Off in the distance, the F-Market tram could be heard screeching to a halt; Ubers were pulling over to deposit product managers at Twitter’s Art Deco lobby. In the cavernous staff commissary, there was the familiar din of conversation as programmers poured Bolivian coffee into black mugs with bluebirds draped around the stem. But in Waterthrush—which, like every conference room at Twitter, is named after a bird—there was only silence.

Then Costolo proffered the second part of his bombshell: “Jack is coming in as the interim C.E.O.”

The Jack in question, as everyone in the room knew, was Jack Dorsey, the co-founder and former C.E.O. of Twitter, who had been fired seven years earlier for prioritizing the pleasures of running a start-up over many of the rigors involved. In those days, Dorsey spent a considerable amount of time going to hot-yoga classes and taking sewing lessons, for instance, when he could have been fixing the nascent social-media company’s server outages. This behavior rankled his colleagues and scared his investors, and led to Dorsey’s becoming another example of a founder who was expelled from the company he had helped start. In the intervening years, however, Dorsey mounted a remarkable comeback. Most notably, he founded a mobile-payments company, Square, which was estimated to be worth around $5 billion, and sat, coincidentally, a mere block away from Twitter on Market Street.

For any normal public company, the sudden exodus of a C.E.O. in favor of a former chief would be a logic-defying or even dystopian turn of events. But Twitter is not a normal public company. From the moment it was born, 10 years ago, it has existed in a near-constant state of chaos. While the average tenure of a Fortune 500 company C.E.O. is around a decade, Twitter has had five leaders in that same period. Its four co-founders have each pushed one another out. If you discounted Costolo’s five-year reign, Twitter averaged one new boss per year. In fact, this would technically be Dorsey’s third time at the helm.

Introducing the Hive, VF.com’s New Tech, Business, and Politics Site

Costolo’s abrupt exit wasn’t supposed to be this way. He had been brought in as an adult C.E.O. to tame Twitter’s madness. And, by nearly every metric, he had achieved remarkable success. Under his tenure, the company had grown from 300 employees to around 4,100. It had increased revenues from literally zero to around $2 billion a year. Twitter had also completely rebuilt its Web site to eliminate fatal server crashes. But Costolo did have one problem that he could not solve. Twitter, which was once among the hottest companies in Silicon Valley, had stopped being cool. It had lost out on news to Facebook; on millennials to Snapchat; on China and India to WhatsApp. Instagram was eviscerating it on images. In a remarkably short time, it had slid from the second-largest social-media company to the ninth. And while Twitter still had 300 million monthly active users—or M.A.U., as they are known in Silicon Valley—it had stopped growing. And there is nothing scarier in Silicon Valley than a company that has stopped growing. As a result, Twitter’s stock had been on a jagged decline for 18 months.

Costolo, meanwhile, was looking for his exit. In December 2014, he had proposed to a Twitter board member and its general counsel that he resign in about a year. The plan allowed time for Costolo to groom a successor, or for the board to find a replacement. Either way, unlike his predecessors’ departures, it would afford him the opportunity to exit gracefully. But at Twitter, nothing is ever that simple. And soon after that private conversation, the company’s stock continued its precipitous decline, and calls for Costolo’s job mounted across the tech and financial press. Then, in early June, Chris Sacca, a voluble investor in Twitter, published an 8,500-word stream-of-consciousness epistle, agitating for a change at the company. Sacca, perhaps livid that he might lose his membership in the so-called Three Comma Club (a pejorative term for tech billionaires), followed up with a series of interviews and tweets lambasting Costolo. Costolo decided that he had had enough agony. He was out.