Our latest Freakonomics Radio episode is called “How to Stop Being a Loser.” (You can subscribe to the podcast at Apple Podcasts, Stitcher, or elsewhere, get the RSS feed, or listen via the media player above.)

The San Francisco 49ers, one of the most valuable sports franchises in the world, also used to be one of the best. But they’ve been losing lately — a lot — and one of their players launched a controversy by taking a knee during the national anthem. So why is everyone there so optimistic? To find out, we speak with the team’s owner, head coach, general manager, and star players, including their new $137.5 million quarterback. (Ep. 2 of “The Hidden Side of Sports” series.)

Below is a transcript of the episode, modified for your reading pleasure. For more information on the people and ideas in the episode, see the links at the bottom of this post.

* * *

Pretend for just a second that you own a National Football League team. How awesome would that be? For starters, you’d be really rich. But also, you’d have a piece of the most successful sports league in history. And that makes you part of the fabric of America. People arrange their schedules to watch N.F.L. games. They are so passionate about your product that they routinely dress up like your employees. Think about that: have you ever seen anybody wearing a U.P.S. uniform who doesn’t work for U.P.S.? This passion translates into millions of eyeballs and billions of dollars — so however rich you started out, now you’re getting even richer. Can you imagine how great that would be? Or — better than imagining — let’s hear from someone who actually does own an N.F.L. team:

Jed YORK: My name is Jed York.

And let’s say this team happens to be one of the most successful, and valuable, franchises ever.

YORK: I’m the C.E.O. of the San Francisco 49ers.

ANNOUNCER: “Rice has just set a Super Bowl record with 12 catches, he’s in motion. Montana. Touchdown! John Taylor!”

In the 1980’s and 90’s, the San Francisco 49ers won five Super Bowls.

ANNOUNCER: “That’s it! The game is over. San Francisco has won Super Bowl XXIII.”

Jed York is 38 years old. The team has been in his family for many years.

YORK: I rotated through every single department. And my first gig was really in the equipment room, learning how to sew nameplates onto the jerseys and doing that stuff. DUBNER: Okay, you’re the C.E.O., I realize it’s your title, it’s an operational thing. Are you the owner? An owner? How does the ownership work? YORK: So, my family owns 90-plus percent of the team, and it’s split between my siblings and my parents and I. My mother is the controlling owner of the team.

As York was moving up from the equipment room to the C.E.O.’s office, the team’s glory days were receding. They did make it to another Super Bowl, six years ago. But they lost.

YORK: It’s hard to lose a Super Bowl and come back in and try to refocus.

Indeed it was hard to refocus. The next few seasons ranged from mediocre to horrible. York did what N.F.L. owners typically do in these cases: he fired the coach, again and again. Some fans thought York should have been fired. They rented a plane and flew it over the stadium with that very message. York’s response was pretty sensible:

YORK: I own this football team. You don’t dismiss owners.

Now, imagine that at the same time all that was happening, this was also happening:

NEWS ANCHOR 1: The San Francisco 49ers quarterback knelt during the national anthem. NEWS ANCHOR 2: Colin Kaepernick’s protest against racial injustice seems to be gaining traction.

And that led to this:

Donald TRUMP: Wouldn’t you love to see one of these N.F.L. owners, when somebody disrespects our flag, to say, “Get that son of a bitch off the field right now. Out. He’s fired. He’s fired!”

Amidst all this chaos, on and off the field, Jed York hit the reset button, hard. The 49ers started the 2017 season with a new coach, a new general manager, and a roster full of new players. They began the year with pretty high hopes. After all, they are the San Francisco 49ers! Those high hopes turned out to be misplaced.

ANNOUNCER: Largest margin of victory over the 49ers, going all the way back to 1980.

And the new coach was miserable.

Kyle SHANAHAN: When you lose a game, a lot of noise happens. When you lose two, a ton happens. Usually, three’s like Armageddon. Try nine.

Nine straight losses to start what was supposed to be your turnaround season. Then you’ve got the President of the United States telling you to fire your “son of a bitch” employees. And your very sport is increasingly thought of as too violent and brutal for the modern world. You sure you still want to own a football team? Despite some headwinds, N.F.L. football is still one of the most popular commodities in sports history. We all know what it’s like to consume this commodity; but what’s it take to produce it? We recently spent a couple days inside the 49ers’ complex talking to everyone: ownership and senior management, the head coach and general manager, and of course the players, including the $137 million quarterback:

Jimmy GAROPPOLO: What’s up guys, I’m Jimmy Garoppolo, and you’re listening to Freakonomics Radio.

And we learned a lot. For instance, how the sports industry is unlike other industries:

Victor MATHESON: So you actually need some level of collusion just to make the product work, right?

How winning is everything but losing can be pretty great too.

Al GUIDO: When we lose, we actually get gifted better draft picks.

We’ll hear how an N.F.L. team makes its money, besides football.

Bob LANGE: Yeah, we went straight from monster truck into Taylor Swift.

And you’ll hear what football players do when they’re not playing, practicing, or lifting weights.

* * *

In the first episode of our “Hidden Side of Sports” series, we looked at how sport has reflected, throughout history, some of the most pressing concerns of our civilization — politics and culture, economics, and human potential.

David EPSTEIN: Athletes were told their legs would fall off if they ran fast enough to run the mile under four minutes.

When we first started thinking about this sports series, we knew we’d want to spend one episode going deep on a single team — preferably before their season began. Not only do they have more time to talk then, but that’s also when everyone is still optimistic, and tied for first place, and uninjured. As for which sport — we figured we’d go straight to the top of the sports pyramid, as the sports economist Victor Matheson described it:

MATHESON: So the biggest league in the world in terms of revenue generated is the N.F.L. And the N.F.L. generates something like $14, $15 billion a year.

We also thought it’d be fun to focus on a team that had a strange season the year before. One of the strangest seasons ever. A season that ran from absolute despair to something approaching euphoria. This set of criteria brought us to the San Francisco 49ers.

DUBNER: So what is this big tunnel here, where are we? LANGE: So this is the underbelly of the stadium.

In May, we visited the team’s complex in Santa Clara, California. They’d just begun their pre-season practices, which are technically called O.T.A.’s, or “organized team activities.”

The place was incredibly busy, considering the season wouldn’t begin for another few months. It was also incredibly upbeat. To understand why the entire building was so enthusiastic about the 2018 season, you have to understand what they went through in 2017. And to understand that, it helps to go back to 2011, the start of the era of Coach Jim Harbaugh. By this point, the 49ers had not been in the playoffs in eight years.

YORK: So, Jim was at Stanford when we hired him.

That, again, is 49ers owner and C.E.O. Jed York.

YORK: And Jim is a guy that is just a huge personality.

A personality that Harbaugh wasn’t shy to show in public:

Jim HARBAUGH: “Personally I think that’s a bunch of crap.”

YORK: And I think with Jim he can certainly rub somebody the wrong way. But he’s not worried about, “I’m going to make sure everybody gets along.” He has one focus in mind and that’s, “How do I win?”

ANNOUNCER: 33-17 is the final score as Harbaugh is a winner in his first game as a pro coach.

Harbaugh turned the team around immediately. They had three excellent seasons in a row, including that losing appearance in Super Bowl, against a Ravens team that was coached by Harbaugh’s brother.

ANNOUNCER: It’s the Harbaugh Bowl. Jim and John Harbaugh, Ravens and Niners, two of the best teams in the league.

DUBNER: Describe to me how much it hurts to lose a Super Bowl? YORK: It’s weird, because we’ve lost N.F.C. championship games before, and it’s weirdly easier to lose the Super Bowl because you can say, “We didn’t have our best game. We didn’t do this.” So, there’s no ifs, ands or buts, there’s no what-ifs.

Not everyone in the 49ers building is as sanguine as owner Jed York.

STALEY: Losing the Super Bowl? Oh man, it sucked. Oh, that’s like the worst day of my life. Thanks for bringing that up.

That’s Joe Staley:

STALEY: I’m a left tackle for the San Francisco 49ers. I’ve been on the team for, this will be my twelfth season coming up, so, only played here in San Francisco. DUBNER: Right. And you’re easily the longest-tenured veteran here — STALEY: And the best. DUBNER: By a long shot. STALEY: And the best-looking. DUBNER: Best-looking, yeah. Your nose, I have to say — STALEY: Leans right. DUBNER: What would I say? STALEY: It leans to the right. It’s been broken a couple of times.

Staley has long been one of the best left tackles in the league. His primary job is to protect the quarterback on passing plays. Which means, in addition to being the longest-tenured 49er, Staley’s also one of the largest.

STALEY: Six-foot-six. I’m about 295, 300 pounds.

He’s also known as one of the goofiest.

STALEY: [singing] Hakuna matata, what a wonderful phrase. Hakuna matata, ain’t no passing craze. It means no worries for the rest of days. It’s our problem-free philosophy, hakuna matata.

Staley also hosts a no-budget web series called “The Joe Show,” filmed in the 49ers locker room:

STALEY: And our first guest is my eighth-favorite player on the football team — Dakota Watson everybody, let’s go!

It pays to stay loose if you’re an N.F.L. player. It is a fairly ruthless business. That 49ers team that went to the Super Bowl six years ago? Staley is one of just two players still on the team. Out of 53. That’s how much turnover there can be on an N.F.L. roster, especially when a team has a bad stretch. And the 49ers had a really bad stretch. The season after the Super Bowl loss, they won just eight games, against eight losses. Coach Jim Harbaugh, whose idiosyncrasies were tolerable during the winning seasons, had worn out his welcome.

YORK: We just couldn’t get to a place where either side was willing to continue to move forward.

On to a new coach and a new season. With even worse results: five wins, 11 losses. Then another new coach for the next season — with an even worse outcome: two wins, 14 losses. That coach was also fired, along with the general manager, who makes personnel decisions. This left Jed York as the primary target of the growing ill will. Here he is at a press conference right after the disastrous 2016 season.

REPORTER: Jed, you dismissed your general manager and coach because they didn’t reach certain performance standards. YORK: That’s part of it. REPORTER: Okay, let’s stick to that part. Why shouldn’t you be dismissed or reassigned for the same reasons? YORK: Look, again, nothing I’m going to say is going to be satisfactory. REPORTER: Say something.

And that’s when York said this:

YORK: I own this football team. You don’t dismiss owners.

No one’s happy when an N.F.L. team is losing: the players, the fans — even, as you heard, the journalists. But, paradoxically, there’s one constituency that has reason to be somewhat less unhappy. Who’s that? The ownership. Here’s something important to know about the National Football League and other big American sports leagues. Every team in every league of course wants to win, but they don’t have to win to be financially successful. Consider the N.F.L. The league is essentially a coalition of the 32 teams. The commissioner serves at the owners’ behest, and promotes their interests. It is essentially a cartel, with membership by invitation only. Unlike the big soccer leagues around the world, there is no promotion into or relegation out of American sports leagues. Unlike corporations, these leagues don’t face much real competition from upstarts and rivals.

MATHESON: So first of all, we see the leagues pretty actively try to crush their competition.

That again, is the sports economist Victor Matheson.

MATHESON: We had the N.F.L. drive the U.S.F.L. out of business in 1985, at least partially through nefarious means. Partially through fairly incompetent management of the U.S.F.L. — probably led most by the owner of the New Jersey U.S.F.L. team of course, Donald Trump.

You might think an economist would oppose this lack of competition. You might think he’d consider this behavior downright collusive.

MATHESON: So sports is really interesting in that you actually need some level of collusion between teams just to make the product work, right? So this is not Apple and Samsung, right? Apple really does want to drive Samsung out of business, so they can grab the whole mobile-phone market. And Samsung wants to do the same thing to Apple. But the New York Yankees don’t want to drive the Boston Red Sox out of business because they need someone to play, and you need to figure out how you’re going to run your league so that you can make a good, entertaining product.

The N.F.L.’s product is certifiably entertaining and, therefore, certifiably lucrative. Importantly, this lucre is equally shared among the 32 teams. Local revenues vary, but every team gets a 1/32nd cut of the national revenue that includes money from TV rights, sponsorships, licensing, and merchandise sales. Last year, the N.F.L.’s total national revenue was more than $8 billion, with each team receiving more than $250 million. And that $250 million check from the league — that’s your share whether you win every game, half your games, or none. When Jed York’s grandfather bought the San Francisco 49ers in 1977, he paid $17 million.

YORK: Obviously the team is probably worth a little bit more than $17 million today.

That’s right: Forbes estimates the 49ers’ value at $3 billion, making it the 10th-most valuable sports team in the world. That’s without having won a Super Bowl since 1995. And that’s with winning two games in 2016. What would happen if a soccer team in the English Premier League did that? They’d get relegated to a lower league and their finances would crumble. The Premier League would give them what’s called a parachute payment, to help them avoid bankruptcy, but they’d have to sell off their best players. An N.F.L. team that wins just two games, meanwhile, still gets that $250 million check from the home office.

Al GUIDO: I actually joke with my English Premier friends.

That’s Al Guido, the 49ers’ president.

GUIDO: Not only that — when we lose, we actually get gifted better draft picks. They actually get relegated down and have to try to come back up. DUBNER: So the football business — I would love to be an N.F.L. owner because it’s kind of a closed model, right? If you’re in, you literally can’t lose. I mean, can you lose money in the N.F.L.? GUIDO: Sure, if you’re one of the lower-revenue tier clubs, but it’s hard. To your point, it’s pretty hard.

I asked Guido to describe his duties as club president.

GUIDO: I oversee everything non-football. So if you think about the sales, marketing, G. and A. functions of the team — DUBNER: G. and A. is? GUIDO: General administrative. So finance, human resources, legal, insurance, all those things. Land development.

Land development in particular is a big piece of the 49ers’ value proposition, as it is for many sports franchises. It’s no coincidence that so many team owners made their money in real estate. This includes Jed York’s late grandfather.

YORK: He was one of the first people to really take the downtown to suburbia and he really enclosed a shopping mall and built a great empire.

On one level, owning an N.F.L. team is a real-estate play. Yes, the athletes are necessary to carry out the game. But athletes come and go. The stadium is the constant, and it’s a cash cow on at least three dimensions: as a stage set for the lucrative TV contracts, as a venue for live events, including of course the football games, and as a sponsorship opportunity. In 2014, the 49ers built and moved into a $1.3 billion, state-of-the-art stadium. It’s now called Levi’s Stadium, after the jeans-maker paid $220 million for a 10-year naming deal. Some of that money goes to the 49ers’ new hometown, Santa Clara, which is in Silicon Valley. It’s about an hour south of San Francisco, where the 49ers had played since 1946.

YORK: We would have loved to have stayed in the city of San Francisco. We looked at over 85 sites in the Bay Area. There’s a lot of work that goes into it from an environmental standpoint, from a governmental standpoint. DUBNER: When it was announced that you were going to build the stadium down here, what was the general public response? YORK: It wasn’t a very positive response, because people wanted us to stay in the city. DUBNER: And what were you portrayed as? Greedy? As not-loyal? What? YORK: Probably more the not-loyal, because in terms of greedy there was very, very little public equity put it into the building.

A modern stadium like Levi’s can generate a lot more revenue than an old studium, thanks to luxury suites and the willingness of fans to pre-purchase season tickets. The 49ers, like most teams, don’t just sell you the tickets; you first need to buy what’s called a “personal seat license,” which then allows you to buy the tickets. When Levi’s Stadium opened, those licenses sold for $2,000 to $80,000 per seat, depending on location.

GUIDO: About 95 to 96 percent of the building is sold out on season tickets. DUBNER: And how does that rate compare to other N.F.L. stadiums? Is that about typical, or a little high? GUIDO: Oh, it’s very high. Very high. Yeah, we are in the top quartile in team revenues inside of the N.F.L.

Keep in mind that N.F.L. teams only have eight regular-season home games per season, with a couple preseason games and, if they’re lucky, a playoff game or two. That’s not a very efficient use of an asset as expensive as a brand-new, high-tech stadium. But don’t worry: the 49ers are active landlords, too. According to Forbes, Levi’s Stadium in its first three years “hosted more non-N.F.L. events… than any other new stadium.” Here’s Bob Lange, the 49ers’ vice-president of communications, while giving us a stadium tour back in May:

LANGE: Yeah, we went straight from monster truck into Taylor Swift last weekend, and then as soon as Taylor Swift got off the field, they are putting down sod. Because we’ve got a soccer match coming up shortly.

So, from a business perspective, the 49ers of the mid-2010’s were doing quite well. Monetizing their beautiful new real-estate investment; taking in their steady share of the N.F.L.’s billions. The only problem was that their actual football team stank. Over three seasons, from 2014 to 2016, they won a total of just 15 games; the New England Patriots won 14 games in 2016 alone, while the 49ers were winning just two games. That was also the season that the 49ers quarterback became the talk of not just the N.F.L., but the entire country. Colin Kaepernick was just a few years removed from having led the 49ers to the Super Bowl. But as the team’s fortunes fell, so did his. He was benched, then reinstalled as the starter, and then benched again. He asked to be traded, but the team refused.

This sort of controversy is standard issue on N.F.L. teams. But then Kaepernick launched an entirely non-standard controversy. It began after a spate of high-profile police shootings of African-Americans. During the national anthem that’s played just before every N.F.L. game, Kaepernick sat on the bench rather than standing along the sideline with his teammates. He later shifted his protest from sitting to kneeling during the anthem. He said he wasn’t interested in “standing up to show pride in a flag for a country that oppresses black people and people of color.”

Colin KAEPERNICK: There’s people being murdered unjustly and not being held accountable. Cops are getting paid-leave for killing people. That’s not right.

As you’re probably aware, this turned into a very big deal.

NEWS ANCHOR: Colin Kaepernick’s protest against racial injustice seems to be gaining traction.

Other players around the league began kneeling in solidarity with Kaepernick. The anthem protests became a political football, turning the actual football into a sideshow and, to some degree, a casualty: a slip in the N.F.L.’s TV ratings was attributed, in part at least, to the anthem protests — although, to be fair, N.F.L. ratings were down much less than most TV shows. Kaepernick himself was ultimately released by the 49ers, and he wasn’t picked up by any other N.F.L. team, despite having strong career numbers. Kaepernick accused the league of blackballing him and filed a collusion case, which as of today is still unsettled. I asked 49ers owner Jed York about the Kaepernick controversy.

YORK: When you look at African-Americans specifically and folks of racial minority and police shootings, there are some things that really aren’t good in our country. Colin probably took a different approach than I would have taken, but he certainly brought attention to the matter. And I understand where people were upset that he took an action during the national anthem. But when I look at where Colin started, of sitting down during the national anthem, he changed his position to doing something that— It’s hard for me to see taking a knee— If you can come up with a community or society where taking a knee is a disrespectful act, by all means show me. So, I mean, I feel like he tried to modify his position to be as respectful as possible during a very, very sacrosanct moment during a professional football game. And I think that the narrative sort of spun out of control. DUBNER: And then you’ve got something that five years ago no one could have predicted:

TRUMP: Wouldn’t you love to see one of these N.F.L. owners, when somebody disrespects our flag, to say, “Get that son of a bitch off the field right now.”

DUBNER: Talk about that, your communication with the White House if there was any, and how that affected you? YORK: So, we didn’t have any direct communication with the White House. The N.F.L. league office may have, we didn’t. The position that we took was, whether you’re for or against somebody taking a knee during the national anthem, you have the constitutional right to be able to do that. Now that doesn’t mean that you are immune from having backlash because of your actions, but you have every right to make that action and take that action. DUBNER: Now there’s a lawsuit alleging collusion among owners. Tell me what you can or do know about that. YORK: It’s really hard to get into something that’s an ongoing lawsuit. I know for us, Colin was kneeling before he regained his starting position with us. So, what his political stance was had nothing to do — DUBNER: So, he was not starting, then the protests started, then he started again. YORK: Correct. Yes. DUBNER: But did he finish out the season then as a starter or — YORK: He did, he finished the season as a starter with us. DUBNER: So, that would seem to be evidence that there was no effort by the 49ers to diminish his professional abilities, right? I mean opportunities— YORK: I certainly don’t believe that there were, and we had no negative conversations with other teams saying, “Don’t sign Colin.” We wouldn’t do that with Colin, we wouldn’t do that with anybody else. DUBNER: Were you deposed? YORK: I was not. DUBNER: In the collusion, was anybody from the Niners deposed in the collusion case? YORK: I don’t believe so.

Between the Kaepernick saga and their worst season in many years, the 49ers were ready for big changes. Just hiring a new coach every year wasn’t working out. So, they realized:

Paraag MARATHE: What might be best is to start from scratch and do a full reboot, because doing half of it each time wasn’t what was giving us the right answer.

That’s Paraag Marathe.

MARATHE: And so the best way to do it is to build it up from the bottom again.

Marathe is, unofficially, Jed York’s right-hand man. And officially?

MARATHE: I am president of 49ers enterprises and executive vice-president of football operations.

Marathe has been with the 49ers since 2001. Before that, he worked as a management consultant at the sports agency I.M.G.; his M.B.A. is from Stanford, his undergrad degree from Berkeley, and he grew up nearby, in Saratoga, the child of Indian immigrants. His dad was an engineer who, when Paraag was 10, decided he wanted to start a family business.

MARATHE: The American dream, right, start a new business. And we put it to a family vote: my dad was gas station, my mom was party store, my sister and I were pizza. So we bought a pizza restaurant. DUBNER: And you were eventually running the place, I gather? MARATHE: I was running the place by the time I was 12 or 13. But it was fun. I had hired a lot of my friends, so we all worked there and we managed a pizza restaurant. DUBNER: What child labor laws? MARATHE: Exactly. So I delivered pizzas too, as a high-school kid. So, I know literally every street in Saratoga. In fact, if you gave me a home address, I would probably tell you the phone number, or vice-versa. Seriously.

With the 49ers, Marathe has been involved in everything from contract negotiations to salary-cap management to the analytics department. When the team bottomed out in 2016, he and Jed York acknowledged that they needed to hire yet another new coach — the team’s fourth in four years — but they also needed a new general manager. That’s the person responsible for deciding which players to get and which ones to get rid of; what kind of contracts they could afford and stay beneath the salary cap. They also realized they had to rethink the alliance between coach and G.M., to make sure they were rowing in the same direction.

MARATHE: So we’d done a lot of research on successful organizations and what made them work, and what didn’t. And one of the things that was of paramount importance is first of all having a head coach and a general manager that were in the same life cycle of their career so one’s not thinking about saving their jobs, and one’s not thinking about trying to prove themselves, right? And another thing was the way— You have different structures across every club: sometimes the G.M. is on top and the head coach is underneath, sometimes it’s the other way around. We wanted to set it up where they were partners. And they complemented each other on what their respective skill sets would be. And then we went out and we looked at all sports and thought about, what are the key attributes of a head coach that we’re looking for? What are the key personality rates and the key skill sets? Same thing at a G.M. So we gave each candidate a list of 10 skills of a head coach or a G.M., and we said, “We want you to rank these one to 10, not on how important they are, but on how good you are at them. And, by the way, you have to be one out of 10 on something, and you have to be 10 out of 10 on something.” And it wasn’t the answers so much that we cared about as how they arrived at it and how they talked about it afterwards. DUBNER: Were some guys not able to put down a one? MARATHE: So many guys did one, two, three, four, and then six-way tie for five. Because they couldn’t be worst at anything. Right? It was just that conversation that they couldn’t consciously allow themselves to be bad at something.

But the 49ers eventually did find someone who knew his own limitations.

SHANAHAN: I’m always assuming, all right, this bad thing’s going to happen, what do we do to prepare ourselves?

And that is:

SHANAHAN: Kyle Shanahan, head coach, 49ers.

Shanahan is only 38 and had never been a head coach. But he had been a wildly successful offensive coordinator for a few teams — and, not unimportantly, he is the son of a wildly successful N.F.L. head coach, Mike Shanahan.

SHANAHAN: Growing up, I was around football my whole life.

Mike Shanahan won two Super Bowls as head coach of the Denver Broncos. He was also the offensive coordinator for the 49ers, back when they won their last Super Bowl. Which meant Kyle Shanahan went to high school here, in the San Francisco area. In fact, when he was a kid — this is apropos of nothing but it’s too cool to not tell you — when Kyle Shanahan was a kid, he’d go for pizza at the pizzeria run by another kid, Paraag Marathe, the man who would eventually hire Shanahan to coach the 49ers.

MARATHE: You’ve done your homework.

In early 2017, as the 49ers were deciding to give Kyle Shanahan his first head-coaching job, he was pretty busy — as offensive coordinator of the Atlanta Falcons, who were preparing to play in the Super Bowl against the New England Patriots. Paraag Marathe and Jed York, however, really wanted Shanahan’s input on who they should hire as G.M.

SHANAHAN: They’re like, “Can you meet with this G.M.? Can you meet with this guy?” No, I’m getting ready for a playoff game, getting ready for the Super Bowl. It got very stressful for me.

Then out of the blue, Shanahan got a text from someone — a former N.F.L. great who was now a football broadcaster, and who was a huge fan of Kyle Shanahan.

John LYNCH: I always thought he was one of those guys that was one step ahead of the competition.

And that is:

LYNCH: My name is John Lynch. DUBNER: For years, I thought your actual first name was “hard-hitting.” Because it seemed like they never say “John Lynch” without “hard-hitting John Lynch.”

Lynch retired as an N.F.L. player in 2008 and was now calling games for Fox.

LYNCH: I had a good career going in the broadcast world, and they were great to me. And I loved every second of it. DUBNER: But you missed the competition? LYNCH: I did. I did. Everybody I think at certain points, at year’s end, you do a little self-evaluation and say, “Oh gosh, my life’s really going well. I got a great family, I’m proud of my kids, I got a great marriage, loving broadcasting —” DUBNER: “But what’s my win-loss record?” LYNCH: Yeah, exactly. And there was always a “but” that was a little unfulfilling.

When Lynch heard that Kyle Shanahan had been offered the 49ers’ head-coaching job, he called to congratulate him.

LYNCH: And I had seen something the day before that he was struggling with finding someone he wanted to work with as a general manager and I just threw out there at the end of our conversation — I said, “Hey, maybe I’d do it.”

SHANAHAN: And he was very polite about it, and he was like, “If you already got a guy, just don’t even worry about it, but I just want you to know I’d be very interested.” And I went downstairs, and I remember telling my parents — who know John, because my dad coached him — and he’s like, “What’d Lynch have to say?” And I was like, “Said he wants to be a G.M.” And my dad’s like, “Oh, what do you think of that?” And I’m like, “I think I really like that.” And it took a lot of anxiety away, because all I want is someone who loves football, who is smart and capable of doing it, and someone that you can work together with.

John Lynch as G.M. was a bit of a stretch — he’d never been a football coach or executive. But he had been a great player, and he was smart — he played his college football at Stanford. There was one more thing going for Lynch.

MARATHE: He’s just a presence.

Paraag Marathe again.

MARATHE: He has such amazing presence. You just — you’re around him for half an hour, and it makes you want to be a better version of yourself.

And so it came to pass that in early 2017, a few weeks after firing their previous head coach and general manager, the 49ers had their new leadership duo: an up-and-coming young coach and an inspiring first-time G.M. Now all they had to do was get the kind of players who could win them some football games. Like this guy.

Solomon THOMAS: Solomon Thomas, I play defensive end for the San Francisco 49ers.

Thomas was born in Chicago; then his family moved to Australia for several years; and then to Texas. He was a big kid — so, naturally, in Texas:

THOMAS: Someone was like, “Why aren’t you playing football?” And I was like, “I really don’t know what football is.” So, we signed up, did the Pop Warner football thing, and first practice, just going out there, was tackling basically the guy in front of me, because I didn’t I know what to do. I didn’t know you were supposed to tackle the guy with the ball.

But Thomas figured out the game pretty quickly and was eventually recruited to play at Stanford. If you’ve begun to think there’s a bit of a Stanford mafia within the 49ers organization, you might not be wrong. It also might not be a total coincidence. In one of his first classes at Stanford, Thomas recognized an older guy sitting up front.

THOMAS: And we’re like, “Who’s that? Oh crap, that’s John Lynch.” And kind of a little starstruck.

Hard-hitting John Lynch, now in his 40’s and in his broadcasting phase, had gone back to Stanford to complete his degree. A couple years later, as the brand-new G.M. of the 49ers, the first player Lynch drafted, with the third overall pick, was Solomon Thomas.

THOMAS: It was just totally a dream come true, it was like — DUBNER: And he’s was like, “This is your former classmate, John Lynch,” was it him or Shanahan who called you? THOMAS: John called me first and said, “Hey, classmate,” and then, yeah. It was pretty insane.

Thomas was one of the key young players the 49ers were rebuilding their defense around. The offense, meanwhile — that was Kyle Shanahan’s specialty — the offense needed even more help, especially at quarterback.

SHANAHAN: I mean, that’s the toughest, to me, position in the world. And there’s 32 teams and there isn’t 32 people who can play that position at the level needed. GUIDO: I mean, if you look at the A.F.C., I think over the last 17 or 19 years, it’s basically been three quarterbacks. So it’s Tom Brady, Peyton Manning, and Ben Roethlisberger. Sprinkle in a few Joe Flaccos. And that’s it.

With Colin Kaepernick gone, the 49ers’ best quarterback options were C.J. Beathard and Brian Hoyer — neither of whom were very good options. But Shanahan and John Lynch and the whole organization knew it’d be hard work to turn things around. And if there’s anything Kyle Shanahan is really, really good at, it’s working hard.

SHANAHAN: During the season Mondays, I’m usually in about 5:30 every day. I leave on a Monday at 11:00, on a Tuesday at midnight, on a Wednesday at midnight, on a Thursday at 9:30, and on Friday, I leave at 2:30. Friday is like my weekend, where I get home at about 3:30, and that’s the night I kind of hang out with my kids. Saturday, I’m in at 5:30, we’re usually traveling somewhere, or we have meetings and a walk-through. I go home for two hours, then go to the hotel. DUBNER: You spend the night at the team hotel on Saturdays? SHANAHAN: Yeah, everyone does. And then on Sundays, I’m over at the stadium very early in the morning. DUBNER: So I have to say, you hear these stories forever about coaches literally sleeping in their offices, working these hours that you described. I think anybody listening this, those hours sound totally nuts. SHANAHAN: Yeah. DUBNER: And my thought is always, “Does it really have to be that way?” For people who don’t know the game or care about it and they hear, “Wait a minute, you’re a football coach, why do you need to be working 18 hours?” What are you doing? SHANAHAN: On a Monday, as a head coach, I need to watch the game for myself, which is offensive-side, defensive-side, special teams. It’s rewind, fast-forward, sideline copy and there’s three clips before we get past one play on one side of the ball. And I’ve got to watch it with the coaches. And then when that is done, I’ve got to get the whole team together and I got to watch certain clips of the team from head-coach standpoint. Anyways, it takes all Monday, all right, it takes all Monday. And now we’ve got to start watching Seattle, who we play the next Sunday.

For the next several minutes, Shanahan describes, in exhausting detail, the rest of the week:

SHANAHAN: Well, I teach the pass game from 8 to 9, then we teach the run game from 9 to 10. Then our special-teams coach comes in from 10 to 10:45 to teach special teams. Then we go out on the field and we have to walk through all that new stuff we learned. Then we come back in and we eat lunch. Then we go out and have a real practice. Now before tomorrow, we got to go study third-downs. We’ve got to study short-yardage goal line. We’ve got to draw it out, the plan, put them on cards how we’re going to practice tomorrow. We only do red zone on Thursday night. So, Friday, same process. … 11 guys versus 11 guys. It’s infinite how many different things you can do and if one guy is off, the play doesn’t work on either side of the ball. And if that play doesn’t work, it could be a hurt quarterback, it could be a touchdown. That could be the reason you’re telling your second-grade daughter that she’s moving next week. … Yeah, there’s not many other ways to do it. I know it’s embarrassing. We’re not doctors, we’re P.E. teachers. I don’t try to explain it to people much, because it’s laughable. And — DUBNER: Has anybody ever tried, has any coach ever said, “You know what, maybe all those hours that we’re working, if we slept more, we’d be sharper and try to make up for it that way?” Has anybody ever tried a totally different approach? SHANAHAN: Yeah, totally. DUBNER: And those are no longer coaching — SHANAHAN: Guys you would never know their name. Because they don’t last long. And, I mean, it’s okay if we’re tired and we barely can function. We don’t have to perform the play. It’s us wearing our brains out all week to put our players in the best opportunity possible for them to be successful.

* * *

In September of 2017, the iconic San Francisco 49ers franchise was ready for their renaissance. They had a new coach, new general manager, many new players, a gorgeous and relatively new stadium, and seemingly all sorts of wind at their back. Then they played their first game. They got crushed by the Carolina Panthers, 23 to 3.

ANNOUNCER: Kyle’s fine, this team will be fine. It’s in good hands with John Lynch, Kyle Shanahan. They’re young and new, they’re going to get better as the season goes on.

But things didn’t get better. The 49ers lost again:

ANNOUNCER: Touchdown, Arizona! Cardinals win!

And again:

ANNOUNCER: It is good! Colts have won it in overtime!

And again and again. Six straight losses to open the season. Amazingly, the last five all were by three points or less.

LYNCH: I mean, that’s hard on a head coach.

John Lynch, the rookie general manager, was worried about his rookie head coach Kyle Shanahan.

LYNCH: And I think a big part of my job the first year was being a psychologist to him. You’ve waited your whole life to do this. And now, all of a sudden, in a historic fashion, we lost five games by three points or less and it had never been done in this league.

How should you interpret those five close losses? Were the 2017 San Francisco 49ers still catastrophically bad — or were they really close to turning the corner? The next few games answered that question:

ANNOUNCER: Largest margin of victory over the 49ers, going all the way back to 1980.

The 49ers had begun their supposed turnaround season 0-9. This affected everyone in the building. And their families. Including Al Guido’s nine-year-old daughter.

GUIDO: So the kids will either make fun of my daughter, right, or if she wears the 49ers stuff, they’ll be like, “The 49ers stink. What’s your dad doing,” type of thing.

SHANAHAN: I mean, when you lose a game, a lot of noise happens

That’s coach Shanahan again:

SHANAHAN: Not just from media members and talk-show hosts, but from family members, from anybody. When you lose two, a ton happens. Usually three’s like armageddon. Try nine. And it happens to where, I mean your wife hears the radio all day, she reads stuff, she — eventually you get home, and everyone’s been saying that their husband sucks so bad and she wants to know why. And eventually, you say, “It wasn’t me, it was this position.” She eventually says that to another wife and that’s how teams get torn apart.

THOMAS: I’ve never lost that many games before, in the season or over my career. And so that was different.

That was defensive end Solomon Thomas. And here’s the linebacker Malcolm Smith.

Malcolm SMITH: No, it was miserable. Miserable. And I actually wasn’t playing, I was on injured reserve, so it was like — DUBNER: So you were out all last year? SMITH: Helpless, yeah. I’d say I was taking it harder than some of the guys on the field. You’re watching, you feel like you can’t do anything.

Joe Staley, the offensive lineman who sings — he was also hurt. Staley played through it, didn’t miss a game, but he started talking about quitting football when the season was over.

STALEY: I was in year 11, I was on my sixth head coach. We’re I think, at this time like 0-7, and it was just like I had mental lapse of weakness there where I was just the adversity got to me.

Kyle JUSZCZYK: Definitely super frustrating, not how we expected things to start.

That’s the fullback Kyle Juszczyk.

JUSZCZYK: But you’d be surprised just how positive things stayed around here. It was pretty incredible.

Juszczyk, who played his college football at Harvard, was also hurt last season. In the third game, he got a concussion.

JUSZCZYK: So, we were playing the L.A. Rams, and we are on the goal line and smacked my head with their linebacker and just had a really, it was really weird. It was almost like a bell just ringing. I remember feeling like a tuning fork. I’m pretty shook up, but I’m sitting in the huddle and I’m definitely messed up. But do I sit down and wait for the trainer or do I, let’s just run this next play and then I’ll figure it out after that? Well, it all happened so quickly I stayed in and I ran the next play. And it was the worst decision. Same thing, ran into linebacker and that one finally put me out, where I was unconscious for a second and then had to get taken in by the trainers and all that kind of stuff. DUBNER: Wow, do you regret, it sounds like you regret the decision? JUSZCZYK: The second play, definitely. I should’ve taken myself out, but things happen so quickly. DUBNER: How much of it is also just macho? JUSZCZYK: There’s a little bit of pride in there, which is stupid, because there shouldn’t be. DUBNER: That’s changing, I gather, in the N.F.L.? JUSZCZYK: It definitely is changing. There’s no shame in taking yourself out in that situation, your brain is way too important for this kind of stuff. And I think guys are starting to understand that a lot more — but it’s still I think so ingrained in all of us that there’s a little bit of that pride that still keeps guys in there.

As Juszczyk was recuperating from his concussion, the 49ers’ season kept getting worse. And yet, he says, Kyle Shanahan managed to keep his 0-9 team from turning on each other, or on themselves.

JUSZCZYK: Nobody was walking on eggshells here, we were still very confident that we were moving in the right direction. And every week Kyle would pull up some clips to show like, “We’re making progress, I swear guys. Hey, just stick to it and it’s going to turn around.” DUBNER: I have to say that just sounds like exactly the opposite of what lay people think about football coaches. JUSZCZYK: Yeah. DUBNER: We think you could have a pretty good game, and then they call you in and show you, “This is the block you missed,” and so on. JUSZCZYK: Oh, that definitely exists. And I’ve definitely been a part of that too. But, I almost feel like it’s more of a kind of a new-age thinking of this more positive feedback and I know it definitely resonates with me. I’ve never gotten much from a coach that’s just screaming at me and telling me how terrible I am. I don’t know. That just doesn’t work for me.

LYNCH: Kyle and I kept saying to each other, like we can go in there and throw a fit and throw water coolers.

General manager John Lynch again.

LYNCH: But those guys were giving outstanding attitude each day.

And here’s Kyle Shanahan:

SHANAHAN: We took over a 2-14 team. We knew we had a long way to work, we didn’t expect to be 0-9, but we’re going to keep working and not reinvent the wheel. DUBNER: We’ve heard from everybody in the building that it was a remarkably positive locker room. And most people attribute that to you. So, I’m curious to hear what you did specifically to make that happen. SHANAHAN: I don’t know if I did a good job. It was my first time in that situation and I think every situation is different. I mean, people act like, there’s a book or something to handle situations, you’ve got to adjust to what the situation is, and you don’t know that until you’re in it. One big reason the 49ers were in that situation is they didn’t have a quality quarterback. And, as Shanahan told us: SHANAHAN: I mean, that’s the toughest, to me, position in the world. And there’s 32 teams and there isn’t 32 people who can play that position at the level needed.

But remember: in the N.F.L., as in all the big American sports leagues, the worse a team’s record is at the end of the season, the better positioned they’ll be to draft the best players from college.

SHANAHAN: We were 0-9. I knew we were going to be in the position to have a high draft pick, a lot of quarterbacks were coming out that we knew were going to go in the first round.

But there was a quarterback already in the N.F.L. who Kyle Shanahan and John Lynch thought could be a good fit for the 49ers.

LYNCH: Yeah, Kyle studied him out of college. SHANAHAN: I studied the heck out of him coming out of college. LYNCH: He was one of the guys who kept showing up on Kyle’s teach tapes, in terms of the quick release, the accuracy of the traits you’re looking for in quarterbacks.

This quarterback was in his fourth season in the N.F.L., but he’d barely played at all. That’s because he was the backup to one of the most successful quarterbacks in history: Tom Brady of the New England Patriots. Brady had just turned 40 years old, but he’d declared that he did not plan to retire anytime soon. And this declaration apparently made the backup quarterback — the heir apparent to Brady — expendable. Here’s 49ers owner Jed York:

YORK: It’s hard to see into somebody else’s building and know where they are and what they’re doing. But when you have Tom Brady, and Tom says he wants to play another four or five years that’s a very, very difficult decision to make for the Patriots.

I asked Shanahan and Lynch how surprised they were to learn that a quarterback they coveted had suddenly become available for trade?

SHANAHAN: I was surprised just because we checked earlier in the year and he wasn’t then, and then it happened just a day or two days before the trade deadline. LYNCH: We called the Patriots about him, we quickly got shut down. They were not interested in get rid of him. I don’t blame them. And something changed, and we were the beneficiary of that. And people called it genius. If that’s genius, I don’t know. We got lucky.

This quarterback’s name is Jimmy Garoppolo.

GAROPPOLO: What’s up guys.

Garoppolo’s agent — who happens to also be Tom Brady’s agent — called to tell him he’d been traded to the 49ers. But Garoppolo didn’t pick up.

GAROPPOLO: I took a nap, woke up to 100 text messages, 100 missed calls. DUBNER: How long was your nap? GAROPPOLO: It wasn’t that long, I swear. You go through so many emotions initially, because you don’t know what’s going on. I’ve never been in this situation before. Your emotions are going wild. But next thing I knew, I was a 49er, and the rest is history.

Garoppolo wasn’t expected to play right away, maybe not even until next season. He had to learn the 49ers offense from scratch, and Shanahan saw no reason to rush their quarterback of the future, and maybe get him hurt. And then, in the 10th game of the season, the 49ers finally won, behind quarterback C.J. Beathard. But the following week, they were getting beaten badly, and then Beathard got hurt. There was no way to salvage the victory. Shanahan sent Garoppolo in anyway.

ANNOUNCER: Garoppolo, moving to his left, looking toward the end zone, he throws, touchdown! SHANAHAN: We’re walking off the field and the crowd is cheering, and we just got blown out, and our fans are excited.

Okay, so now the 49ers are 1-10. In the next game, Garoppolo gets his first start:

ANNOUNCER: Garoppolo over the middle, caught by Taylor! First down and more.

The 49ers beat the Chicago Bears, 15-14. Here’s Solomon Thomas:

THOMAS: It was just, a win felt so good and it was something that we didn’t want to take for granted and something that we always wanted to keep feeling.

The next game, Jimmy Garoppolo passed for 334 yards, and the 49ers won again.

THOMAS: And we got on a roll and Jimmy came in, was doing incredible. That motivated the team as well and it was pretty special.

With Garoppolo leading the way, the San Francisco 49ers won five straight games — including three against playoff-bound teams — and they finished the season at 6-10.

ANNOUNCER: See you later! Touchdown San Francisco!

What are the odds of a team losing their first nine games and then winning their last five? You can’t count that high.

MARATHE: It’s not like Jimmy was the savior, right? It’s the whole team.

Paraag Marathe again.

MARATHE: And every single player played better, had more confidence, and saw the culmination of their hard work and patience that they had towards the vision sort of come to fruition. Jimmy was the catalyst, the first spark plug, but it really ignited the whole team.

Here’s Joe Staley:

STALEY: I mean it was huge for our team last year to finish the way we did. Jimmy coming in really made a huge difference for us.

And Kyle Juszczyk:

JUSZCZYK: I think you really got to give Jimmy a lot of credit. I mean, he put in serious time, after practice, with the coaches, by himself. I mean, he was here all night just trying to learn this playbook.

And Jed York, the owner:

YORK: I mean, it was very clear that Jimmy was a guy that took everybody’s attention on the field. Like the guys gravitated towards him. And he’s a natural leader.

As a reward, Jimmy Garoppolo — having sat on the bench for four seasons in New England, and then started a grand total of five games for San Francisco — Garoppolo signed a five-year contract worth $137.5 million. It was at that point the richest contract in N.F.L. history.

GAROPPOLO: For the most part I just go out and do my thing. All the outside noise, it’s just noise. If you get caught up in all that stuff, you’re going to have a tough time. The N.F.L.’s hard enough as it is. DUBNER: From everything that we’ve heard, from everyone on the exec side and on the players side, you’re some combination of Y.A. Tittle and Superman and Jesus Christ, people just gather around you and love you. GAROPPOLO: That’s a hell of a combo right there. DUBNER: It’s a pretty good combo. GAROPPOLO: Yeah, I think I’ve never really tried to fake it or be, I don’t know, someone that I’m not, because guys, especially in a N.F.L. locker room, they see right through that. They’re not dumb. So, you just have to be yourself. I don’t know. I’ve always thought myself as one of the guys and I think that plays a big part in it.

It had been a bizarre season for the 49ers. The deepest gloom replaced, almost overnight, by the brightest of futures. But now, there was a question: what, exactly, are the San Francisco 49ers? Are they the best 6-10 team in history, the team that won their last 5 games? Or are they — well, a 6-10 team? Teams that go 6-10 one year aren’t very likely to win the Super Bowl the next year. Although sport being sport, crazy things do happen. That’s one reason we like it. So what happens this year? Back in May when we visited the 49ers, I’d asked York and everyone else to predict how the team would finish this year. Their answers were, to me at least, remarkable. And they probably said a lot about what kind of mindset you need to run a team, and the mindset of a working athlete. Here’s how the executives — York, Guido, Lynch, and Marathe — answered when I asked about their expectations:

YORK: I think, you never know what’s going to happen in an N.F.L. season, but it’s really about getting better each and every game. GUIDO: I don’t have any predictions on wins or losses. LYNCH: I don’t want to put a number on it. MARATHE: That we continue to stay on the path. If we were still building toward something and it didn’t necessarily lead to wins, that’s okay.

I think you’d agree the executives are the definition of noncommittal. And here are the players. They, I think you’d agree, are anything but noncommittal. Here, in order, are Solomon Thomas, Kyle Juszczyk, Malcolm Smith, and Joe Staley.

THOMAS: Our goal is to win it all. And I feel like we have the potential to do that. JUSZCZYK: I got high expectations. I expect to win. I think you can already that things feel a lot different than they did last year. SMITH: The ultimate success would be the Super Bowl. STALEY: I always think of it as a Super Bowl.

We also spoke with the 49ers placekicker, Robbie Gould. one of the most accurate and productive kickers in the modern N.F.L. He’s been in the league since 2005, most of those years with the Chicago Bears. He’s grateful for his longevity and realistic about his future.

Robbie GOULD: I mean you can be here one day and gone the next. I mean, I got cut in Chicago on Labor Day weekend, after making the team and then the next day, it’s just how it is. DUBNER: How high are your hopes for this year? Obviously you ended last year amazingly well. GOULD: I think the expectations and the locker room and the field and the vibe is pretty high. DUBNER: You think this team can win 10 games? GOULD: I think they can win a Super Bowl. I think it’s just a matter of how bad do you want it? I’m not here to win a T-shirt and hat. I’m here to win a Tiffany’s trophy. That’s it. That’s the only reason I’m here and if you are here for a T-shirt and hat, then I’ll buy you the T-shirt and hat, because I want the trophy.

In the N.F.L. season that’s just begun, the San Francisco 49ers lost their first game — on the road, against the favored Minnesota Vikings — and then beat the Detroit Lions at home — but barely, nearly blowing a big lead. As Jed York told me by e-mail after the game, “We need to finish better if we want to get to the promised land.”

Special thanks to Victor Matheson and all the 49ers, but especially Bob Lange, their V.P. of Communications.

Freakonomics Radio is produced by Stitcher and Dubner Productions. This episode was produced by Anders Kelto and Derek John, with help from Harry Huggins. Our staff also includes Alison Craiglow, Greg Rosalsky, Greg Rippin, Alvin Melathe, Zack Lapinski, and Andy Meisenheimer. The music you hear throughout the episode was composed by Luis Guerra. You can subscribe to Freakonomics Radio on Apple Podcasts, Stitcher, or wherever you get your podcasts.