Photo: Paul Sakuma/AP/Corbis. Illustration by Steven Noble.

If all goes as planned, Facebook will finally pull the trigger later this month on its long-salivated-over IPO. The deal could value the company in the neighborhood of $100 billion, making founder and CEO Mark Elliot Zuckerberg’s own unusually large stake worth $25 billion. It is a huge sum, even in context. Zuckerberg’s impending fortune is more money than Wal-Mart’s 10,000-plus stores made last year. It’s more than Wall Street paid in bonuses to New Yorkers last year. And it has been amassed in only eight years by a 27-year-old who not long ago passed out business cards reading “I’m CEO, bitch.”

The Zuckerberg most people know is the one depicted by The Social Network: nerdy, insecure, and shady—in no way a mature adult who’s earned such massive wealth. His awkward public appearances over the years have not improved that impression. Zuckerberg may have written the original code for Facebook, the common view of him goes, but the company’s success since then—the service is now used by nearly one-eighth of the world’s population—has come more despite him than because of him. He was just in the right place at the right time.

But this view sells Zuckerberg massively short. Getting a company to grow as fast as Facebook has is extraordinarily difficult, even when users do a lot of the work. It’s even more challenging when you go in having never raised so much as a dollar from investors or managed a single employee, and you’re fighting to stay ahead of some of the richest, most aggressive, and most talented companies in the world.

“Mark has done two things in his twenties,” a colleague of Zuckerberg says. “He has built a global company, and he has grown up.” The second one made the first possible. When early mistakes risked an employee mutiny, Zuckerberg knuckled down and learned how to lead. He made himself the pupil of some of the best bosses in business but had the maturity never to let outsiders sway his overall vision. He got adept at hiring the right people, and, more important, firing senior employees whom the company had outgrown. Appalled at the way he was portrayed in The Social Network, Zuckerberg initially wanted nothing to do with the movie—then, deciding not to let it define him, he rented out theaters in a Mountain View cineplex and bused the entire company over to see it.

“Was he lucky?” another early colleague of Zuckerberg says. “Of course. We’re all ridiculously lucky. But you also make your own luck. The world has overlooked how great Mark is as a CEO.” He was, yes, in the right place at the right time—but he also has leadership qualities that really set him apart.

As Facebook embarks on its IPO “road show,” the question of just how good Zuckerberg is will trail it: His control of the company is such that a bet on the company’s stock is a bet on him. Investors will be wagering on an entrepreneur who’s committed himself to getting better and better as a leader. But they’ll also be betting on one whose commitment to his long-term vision is so deep that he just might drive Wall Street crazy.

When Zuckerberg created “Thefacebook,” there were already similar services on other college campuses. Columbia had one. Stanford had one. Yale had one. At Harvard, Zuckerberg’s schoolmates the Winklevoss brothers had, famously, been trying to get one off the ground for months. Meanwhile, out in the real world, Friendster had amassed more than 2 million users. There was MySpace. There was AOL, which had established the “friend” concept almost a decade earlier with its instant-messaging system’s Buddy Lists.

Today, all those other social networks are effectively toast, while Facebook is closing in on 1 billion ­users. Why? Because Facebook has executed better. And that starts with Zuckerberg’s formidable instincts.

All great consumer-technology products share two attributes, which is that they are cool and easy to use. From the beginning, Zuckerberg knew how to make products that were cool and easy to use. He didn’t “overbuild” Facebook, packing it so full of features that people couldn’t figure out how to use it. He made “uptime” a huge early priority, only rolling out Facebook to new schools when he was certain that the company’s servers and software could handle the traffic load. These steps sound like no-brainers, but they trip up a lot of technology start-ups. Stanford’s predecessor to Facebook, for example, was so complicated that it never really caught on. Friendster grew so fast that its infrastructure got swamped: People wanted to log on, but they couldn’t. A year later, when Friendster finally fixed the problem, its U.S. users were gone.

Many promising tech companies place too much emphasis too soon on the business rather than the product. They worry too much about “making money.” This sounds nuts—aren’t companies supposed to make money?—and it sounds especially nuts in the wake of the dot-com bust. But that crash was a product of investors’ and analysts’ overexuberance (sorry!), not evidence of a fundamental flaw in the tech industry’s start-up ecosystem. In a market where ­speed is critical, venture-capital funding allows young companies to move faster than they could if they had to rely only on revenues to fund product development. Entrepreneurs who understand that tend to stick around to make plenty of money later.

MySpace was the last company that had a real shot at stopping Facebook. By 2005, it had more than 5 million users; Facebook hadn’t yet reached 1 million. For a while after News Corp. bought MySpace in 2005 for nearly $600 million, it kept growing, and Rupert Murdoch was lauded as the only “old media” mogul who wasn’t a new-media moron. But Murdoch had acquired a flawed service: Rather than forcing its users to interact under their real names—as Facebook did, to the benefit of its social function and its attractiveness as a marketing tool—it allowed them to adopt whatever identity they wanted. Worse, News Corp. was too focused on the business side. MySpace cluttered its pages with ads and underinvested in product development, ­becoming an ad-choked cesspool.

Zuckerberg, notoriously frugal in his own spending, actively disdained Facebook’s early business efforts, insisting that ads on the service meet his exacting specifications. Advertising might have been helping to fund Facebook’s growth, but advertising wasn’t cool. And Zuckerberg wasn’t about to let ads ruin Facebook.

Most entrepreneurs are creative and impatient, an often fatal combination—trying to do too many things, they spread their tiny companies too thin. This is one trap Zuckerberg almost fell into. After moving his small Facebook team to Palo Alto in the summer of 2004, he turned much of his attention to building a file-share product called Wirehog. Facebook was going gangbusters, but Zuckerberg wasn’t sure it would last; this was his hedge.

Wirehog evolved into one of Facebook’s first apps, but it never amounted to much. At the end of that summer, Facebook raised its first real outside capital, and Zuckerberg’s focus returned. Focus became so central to Facebook’s ethos that in the company’s old office, the word was stenciled over a urinal in the bathroom.

As part of Facebook’s IPO filing, Zuckerberg, following a tradition established by Jeff Bezos at Amazon and continued by the founders of Google and other iconic tech companies, wrote a letter to potential shareholders. The document lays out his management philosophy and priorities (and relays a warning to a certain kind of stock buyer—which we’ll come back to later). The Facebook way, Zuckerberg writes, is to “move fast and break things.” It’s the last crucial part of his natural feel for the tech business, and it’s been critical to his company’s success.

When Zuckerberg launched “Thefacebook,” it blindsided the Winklevosses, with whom Zuckerberg had been working to develop a similar product. The legal settlement Facebook later paid to clean up the resulting mess cost the company millions of dollars, but if Zuckerberg had delayed the launch of his social network—whether to negotiate with the Winklevosses or to perfect the site itself­—Facebook might have missed its window. “Move fast and break things” has continued to drive the company’s evolution. Instead of extensively focus-grouping new features, Facebook just rolls them out. Then it listens to users’ screams and makes modifications as appropriate. This technique has produced a lot of duds. It has led, on many occasions, to Zuckerberg having to apologize to his users. It has also produced some of the features that, in the minds of users, today are Facebook—such as News Feed. What the critics miss when they blast Facebook for “mistakes” is that the process is deliberate. And it works.

Zuckerberg all but stopped writing code for Facebook in the summer of 2005. At the time, the company had several million users and about 25 employees. It also had plenty of money, having just raised more than $12 million from Accel Partners, at nearly a $100 million valuation. From then on, Zuckerberg became a full-time leader. And in the beginning, he was horrible at it.

Tech-company founders are often young and socially awkward, with “bad hair” (as one Silicon Valley veteran observes), strange work habits, and scant management experience. This makes money people nervous. So for the past couple of decades, the standard playbook has been to have the founder remain CEO until the company reaches a size that outstrips the founder’s limited ability to run the business, then bring in a “professional CEO”—an experienced executive—to take over. After the professional CEO arrives, the founder usually becomes a neutered figurehead. (If the founder meddles with the course the new CEO sets, it can lead to the founder getting pushed out entirely.) Companies like eBay and Cisco were built this way, as were hundreds of smaller firms that then sold out to bigger operations, yielding handsome scores for their venture capitalists.

In recent years, however, a new approach has taken hold. Championed by V.C. firm Andreessen Horowitz, this contrarian philosophy observes that many of the most flourishing and sustainable technology companies have been built by founder CEOs, not outsiders. Microsoft, for example, was for two decades built and run by Bill Gates, another Harvard dropout who knew nothing about management when he started. Bezos had been an investment banker before he launched Amazon in his garage. Oracle is still run by its co-founder, Larry Ellison. And Google’s CEO is, once again, co-founder Larry Page.

Many companies that have dumped their founders and gone the professional CEO route, meanwhile, have eventually lost their way: Yahoo, for example, has imploded, and Microsoft has struggled since Gates handed off the company to current CEO Steve Ballmer. And then, of course, there’s Apple, which in 1983 recruited the head of Pepsi, John Sculley, to take over, believing that young product visionary Steve Jobs wasn’t cut out to steer the company. You know how that turned out.

In industries in which products don’t change much—paint, bricks, chemicals—professional CEOs thrive. Companies in these industries don’t rise and fall on innovation—they depend on optimization. (Think Coke, which has been selling the same core product for 126 years.) The tech industry works differently. “The nature of technology,” Marc Andreessen, the Netscape co-founder who is one of Andreesen Horowitz’s chief partners (and, full disclosure, is also an investor in my website Business Insider*), said at a conference recently, “is that the product is always changing. It’s just so rare that you’ll have the same product in five years.” Apple’s recent renaissance began in 2001, with the launch of the iPod. A decade later, the iPod is obsolete, and a staggering two-thirds of Apple’s revenue now comes from products it has invented since 2007.

“If you put a sales guy in charge of the company,” Andreessen continued, “they’ll optimize for the next quarter. Finance guys will optimize the financials.” The company’s founder will optimize the products—and will often have the vision necessary to drive the company’s future innovation. As for the nuts-and-bolts skills necessary to lead a company, those can be learned.

The first thing a leader needs to learn to do is communicate—tell his team where they’re going and why. This is especially true when dozens of employees are being hired monthly, each with his own ideas about how to do things and what’s best for the company. After Zuckerberg stopped coding at Facebook, though, he didn’t communicate—he disappeared. He did so because he hadn’t yet learned another critical leadership skill: the art of saying “no.”

Having missed out on buying MySpace, Viacom was desperate to buy Facebook. Because Viacom was interested, so was Time Warner. So were Google, Yahoo, and Microsoft. Zuckerberg had told his employees he didn’t want to sell. But he didn’t tell that to Facebook’s suitors, at least not directly enough. In one classic example reported by David Kirkpatrick in The Facebook Effect, Viacom’s lead negotiator, MTV president Michael Wolf, told Zuckerberg that he would be in San Francisco in mid-­December and offered him a ride back to New York for the holidays. Zuckerberg accepted the favor. Then, because Wolf actually hadn’t been planning to be in San Francisco and Viacom’s planes were booked, he chartered a jet and flew out to the West Coast to pick up his quarry.

While Zuckerberg was getting schmoozed, morale at Facebook deteriorated. Employees began grumbling about the need for a professional CEO. Things got so bad, Kirkpatrick reports, that one of Zuckerberg’s senior executives confronted him at 2:30 in the morning in a diner—the only face time she could get. If Zuckerberg wanted to run the company, the executive told him, he needed “CEO lessons.”

One quirk of Mark Zuckerberg that frustrates colleagues is that he often doesn’t appear to be listening to them. But he is. A week after the diner intervention, Zuckerberg held his first “all hands” meeting. He held more one-on-one meetings with members of his senior team and scheduled an executive retreat. He got better at explaining priorities.

These efforts helped, but they weren’t enough to stop tech pundits from howling that Facebook needed to put a grown-up in charge. So Zuckerberg sought more counsel, cultivating a who’s who of advisers, including Jobs, Andreessen (now a Facebook board member), Don Graham of the Washington Post, LinkedIn’s Reid Hoffman, Accel Partner’s Jim Breyer, and Peter Thiel, an iconoclastic investor and entrepreneur who was Facebook’s first professional funder. “He’s a sponge,” one Valley veteran says. “He’s always asking questions. ‘What do you think about this? What do you know about that? Who’s good at that?’ ”

Two years ago, at the All Things D technology conference, Zuckerberg participated in a live interview. He walked onstage in his typical attire: blue jeans, T-shirt, and hoodie. But it was hot under the lights. As his interrogators, Walt Mossberg and Kara Swisher of The Wall Street Journal, jumped right in with the touchiest line of questions—about Facebook’s incursions on its users’ privacy—he began to sweat. That night, all anyone could talk about was how anxious and nervous Zuckerberg had looked.

*This article has been updated to reflect that Marc Andreessen is an investor in writer Henry Blodget’s website Business Insider.

But if his delivery was a mess, Zuckerberg’s answers to the privacy questions were actually reasonable. Facebook was committed to giving its users full control over their privacy settings. A few minutes later, with Zuckerberg now wiping the sweat from his face with his hoodie sleeve, Swisher asked him, maternally, whether he might like to take it off. (He did.) Toward the end of the conversation, she asked him about the role of the CEO. His answer to this question showed he approaches his job just the right way.

“I’ve always focused on a couple of things,” Zuckerberg said. “One is having a clear direction for the company and what we build. And the other is just trying to build the best team possible toward that … I think as a company, if you can get those two things right—having a clear direction on what you are trying to do and bringing in great people who can execute on the stuff—then you can do pretty well.” For Facebook, that last part has proven an understatement.

One of Steve Jobs’s famous recruiting techniques was to take potential hires on long walks around Palo Alto while sharing his vision for Apple. A Zuckerberg confidant says he’s adopted this tactic and done his idol one better. Near Facebook’s old headquarters in Palo Alto is a trail winding up into the mountains. Zuckerberg led recruits up this trail, the source says, and learned to time his pitch so the full “aha” would hit right as the hike culminates in a breathtaking view.

The team Zuckerberg has built at Facebook, one insider argues, is “pound for pound one of the two strongest management teams in the industry,” with the other being Apple’s. “That did not happen by accident. Mark worked his way through it, position by position.”

“Basically, there are two ways to build an organization,” a former Facebook employee explains. “You can be really, really good at hiring, or you can be really, really good at firing.” Zuckerberg has been really good at firing. “We made some hires that weren’t the right ones. And we were pretty good at correcting that quickly. Mark deserves the credit for identifying and following through with that.” In other cases, key personnel who were good fits simply got outgrown by the company. It can be even harder to jettison those kinds of employees, whose contributions have earned them the loyalty of business partners and colleagues. But here too Zuckerberg did not flinch.

Sean Parker, for example, joined Facebook in the summer of 2004 as the company’s first president. He kept Facebook on track when Zuckerberg’s attention wandered to Wirehog and helped raise the company’s first rounds of outside capital. Most crucially, he did something that will allow Zuckerberg to maintain almost complete control over Facebook for as long as he wants to control it.

Parker, who’d been ousted from both Napster and a later startup, a digital Rolodex service called Plaxo, became obsessed with making sure Zuckerberg didn’t suffer the same fate. In conjunction with raising $500,000 from Thiel, Parker helped restructure Facebook’s voting stock. Zuckerberg today holds 57 percent of those shares, which means that no one, including Facebook’s board members, can legally force him to do anything. This level of control in the hands of one shareholder is extraordinary, and it’s already raising hackles on Wall Street. But it was crucial to getting Zuckerberg comfortable with taking Facebook public, because it means he won’t be compelled to take shortcuts to appease impatient shareholders.

For all Parker brought to Facebook, though, his party-boy ways were deemed too great a liability for him to have a future at the company. Within a year of Parker’s joining the company, he was forced out.

Parker’s departure made room for Owen van Natta, a former Amazon executive hired as head of business development and then promoted to chief operating officer. The 36-year-old Van Natta was Facebook’s first real adult supervision. There were 26 employees when he joined, only two of whom were over 30 years old. During his tenure the staff grew to hundreds, and he had helped hire a lot of them.

Van Natta also got Facebook’s business engine running, assembling its first sales and finance teams and negotiating an investment from Microsoft in 2007 that valued the company at $15 billion. Revenue increased from less than $1 million to more than $150 million. At heart, though, Van Natta was a start-up guy. He thrived on the loosely organized chaos of a young company growing at hyperspeed. His greatest strength was deal-making, not management. In early 2008, in the wake of the disastrous launch of an advertising product called Beacon, Facebook’s senior team determined that the company needed a different kind of executive running the business. So Zuckerberg let Van Natta go.

“The criticism [of CEOs like Zuckerberg] is that they’re overly Machiavellian and don’t care about people,” says a former Facebook executive fired by Zuckerberg. “But this is really what is required to build a long-term sustainable business.” The executive added that while many people canned by Zuckerberg over the years feel screwed over, he couldn’t think of any instance in which Zuckerberg was actually unfair. “He is not a bad guy,” the executive says. “Maybe he’s not a good guy, but he’s not a bad guy.”

Removing Van Natta made it possible for Zuckerberg to hire Sheryl Sandberg, one of the most important moves he has ever made. (A longtime Facebook exec calls the subsequent partnership between Zuckerberg and Sandberg “a blessing from the gods.”) Zuckerberg spent more than 50 hours wooing her away from Google, where she had built and run the online-sales organization. According to a New Yorker article by Ken Auletta, after meeting at a Christmas party in 2007, they had several sit-downs over the next couple of months—first at a café in Atherton, near Sandberg’s house; then, because that was too public, in Sandberg’s kitchen (at the time Zuckerberg was living in a tiny apartment with barely any furniture). When the tech elite flew to Davos for the World Economic Forum that January, Zuckerberg rode with Sandberg and the gang on Google One—the 767 owned by Google founders Larry Page and Sergey Brin. The two spent the flight huddled conspiratorially—a fact that did not go unnoticed within Google. In addition to her being phenomenally good at the job Facebook needed doing—building and managing a global corporation—Zuckerberg found another attribute appealing: She was okay being No. 2. Most of the executives Facebook considered for the COO slot admitted that they would eventually like to be in charge. Facebook already had its CEO, so this was a nonstarter.

For some Zuckerberg skeptics, it’s the quality and stability of the management team he has built that’s made them believers. To attract and retain people like Sandberg, who don’t need to work and can work anywhere, he has had to first be a good boss—talented people don’t like working for assholes—and, second, to let go of aspects of his company that another founder might have clung to. One former Facebook executive believes that the management blunders Zuckerberg made in Facebook’s early years are part of what has made his partnership with Sandberg work so well. The former exec likens this experience to the mistakes he made in relationships before he got married: “All that learning and fucking up in the past is what makes me a great husband.”

The Zuckerberg-Sandberg duo has been so successful—annual revenues have increased from $150 million to nearly $4 billion since she came aboard—that it has now become a new model for tech company-building. Instead of replacing the quirky founder with a professional CEO, companies now try to “go get a Sheryl.”

When talking about Zuckerberg’s most valuable personality trait, a colleague jokingly invokes the famous Stanford marshmallow tests, in which researchers found a correlation between a young child’s ability to delay gratification—devour one treat right away, or wait and be rewarded with two—with high achievement later in life. If Zuckerberg had been one of the Stanford scientists’ subjects, the colleague jokes, Facebook would never have been created: He’d still be sitting in a room somewhere, not eating marshmallows.

Most Wall Street investors would perform miserably on the marshmallow test. Over the past couple of decades, as the money-management business has gotten ever more competitive, they have elevated the narrowly defined concept called “shareholder value” to an absurdly exalted status. Shareholder value, in the minds of most investors, is synonymous with “today’s stock price.” If today’s stock price is higher than yesterday’s stock price, a company’s management is said to have “created” share­holder value. If today’s stock price is lower, management “destroyed” it. It doesn’t matter that the decisions and priorities that boost stocks in the short term—such as inflating this year’s earnings by firing people or cutting product-development spending—are often at odds with decisions and priorities that create greater value over the long haul.

Nor does this obsessive focus on stock prices recognize that companies are a lot more than ticker symbols. They create jobs that employ people. They create products that help people. They devote resources to ensure that they’ll keep creating this value for decades, despite the fact that these investments reduce their near-term profits. In other words, these companies create societal value. As Warren Buffett and a handful of other investors have often observed, this balanced approach allows such companies to create huge value for some shareholders: the ones who stay put for the long term.

It often takes decades to build the sort of companies that the best executives and entrepreneurs hope to create. It can take so long that by the time this value is finally created, many short-term investors will have long since jettisoned their positions. In the last couple of decades, no company has better illustrated this than Amazon. After Amazon went public in 1997, Bezos ignored skeptics who claimed that the ­company “couldn’t make money,” and then, when Amazon finally proved these nay­sayers wrong, he ignored those who complained that Amazon should make more money. All the while, he kept on investing. Five years ago, for example, when Bezos decided that the world was ready for e-books, he poured resources into the Kindle at the expense of Amazon’s bottom line.

Bezos’s philosophy has created enormous value for Amazon’s customers. It has created more than 65,000 jobs. And it has also created mind-boggling value for Amazon’s long-term shareholders: At a recent price of $225, the stock is trading at about 130 times its IPO price. But that growth did not follow a straight-upward line. When the tech bubble burst, Amazon’s stock tanked. While the company continued to invest in the future at the expense of the present, the stock crawled along sideways for years. Impatient shareholders took losses, then missed out on the windfall when Amazon’s share price started to climb in 2007.

The letter that Zuckerberg included in Facebook’s IPO prospectus is even more direct about his priorities than Bezos’s was. Zuckerberg wrote this letter himself, a ­Facebook source says, and it begins with the following sentence: “Facebook was not originally created to be a company.”

Rather, Zuckerberg explains, Facebook “was built to accomplish a social mission—to make the world more open and connected.” Then Zuckerberg reveals why he’s telling us this: “We think it’s important that everyone who invests in Facebook understands what this mission means to us, how we make decisions and why we do the things we do.” Later, he spells out it out again. “We don’t build services to make money; we make money to build better services.”

For short-term investors, the letter amounts to three-alarm klaxon: “Don’t buy this stock!” Because not only is Zuckerberg declaring that he considers Facebook’s social mission a higher priority than Facebook’s business and financial mission—a view many on Wall Street would consider treasonous—he also has complete control over the company. All shareholders will be able to do if they disagree with his decisions is complain. And Zuckerberg has long since demonstrated that he’s willing to withstand bitching while he executes his plan.

In early April, Zuckerberg did something that started his critics grumbling anew about his stewardship of Facebook. With the then-rumored IPO date only a month or so away, he decided to buy a little mobile photo-sharing company called Instagram that had no revenue and only thirteen employees. He spent $1 billion of Facebook’s stock and cash to acquire it—without asking anyone else’s permission or advice.

The billion-dollar price tag, many pundits concluded, was clear evidence that the tech bubble was back—an assessment that called into question Facebook’s valuation at a critical moment. A corporate governance expert told The Wall Street Journal that Zuckerberg’s Instagram move was exactly the sort of situation from which boards were supposed to protect minority shareholders.

But experienced tech executives concluded that the deal was shrewd. For the equivalent of around one percent of Facebook’s value, Zuckerberg had bought one of the hottest companies in the white-hot mobile sector, an area where Facebook was weak. He had stolen Instagram out from under an emerging rival, Twitter, and he had eliminated a potential competitor to Facebook’s vital photo-sharing function—both of which will protect the company’s bottom line as the industry evolves. He had done the deal in a weekend, because he still believes in moving fast.

It’s true that in the process, he threatened to delay Facebook’s IPO as the company scrambled to update its SEC paperwork. But to Zuckerberg, a minor IPO delay would have been of little consequence. As CEO, he has more important things to think about.