As NASCAR staged its annual Brickyard 400 at Indianapolis Motor Speedway July 28, it left many fans with a sinking feeling as they saw thousands of empty seats and witnessed what was for the most part an uninspiring race.

But just a few days earlier, NASCAR announced part of a staggering television package â€” a jaw-dropping $8.2 billion, 10-year deal with NBC and Fox. For a sport supposedly on the decline, it had just attracted its biggest windfall.

MORE: Mich. TV sked | Fox resolves cable dispute | Fox adds races | TV concerns

Since the last NASCAR TV deal negotiated in 2005, television ratings have fallen 47 percent for Sprint Cup telecasts and admissions revenue for the publicly traded track companies has plummeted 42 percent.

And yet NASCAR just landed a new deal in which the rights fees went up 46 percent, from an average of $560 million a year to $820 million. Thatâ€™s a boon for the sport, especially for NASCAR and its tracks with even the teams getting a piece.

MORE: Ganassi candidates | L.A. Times: Montoya fizzles | Detroit News: BK in trouble

NASCAR attracted that windfall thanks to the infant Fox Sports 1 and the emerging NBC Sports Network both wanting to go head-to-head with sports television behemoth ESPN. Television executives wanted a piece of the pie to drive higher subscription fees and advertising rates for live sports programming.

â€œThere are a lot of well-financed television networks that are looking for compelling live product that has a track record â€” if you donâ€™t mind the pun â€” with the American public,â€ said former CBS Sports President Neal Pilson. â€œNASCAR fits that description.

â€œRatings have been off from prior years, attendance is a little soft for a variety of reasons. But still when you look at the other options and choices that are out there for long form, long schedule events, NASCAR has been a good product ever since, frankly, I put the 1979 Daytona 500 on the air live.â€

Back in 2005 when NASCAR signed its current $4.48 billion eight-year television deal with Fox, ESPN and TNT, the sport enjoyed impressive television ratings with an average rating of 5.3 for the 36 Sprint Cup races. The three public track companies that have 90 percent of the races also benefited, reporting $450 million in ticket sales for all racing (including non-NASCAR) events.

When NASCAR went to the negotiating table last year, the majority of races had moved from network to cable with ratings dropping to an average rating of 3.6 in 2012. The relatively same track owners took in just $262 in admissions revenue.

But instead of dropping the rights fees, Fox and NBC â€” needing programming for their cable networks â€” gladly agreed to write big checks while ESPN and TNT scoffed at the idea of paying such big dollars for a sport that ranks as one of the most expensive to cover.

â€œLike all these deals, there is an element of being in the right place at the right time,â€ said Zak Brown, president of Just Marketing and a motorsports industry insider. â€œCompetition is supply and demand and you didnâ€™t have NBC two years ago (before Comcast) acquired Versus.

â€œAll it takes is two bidders to drive up the price. â€¦ If NBC hadnâ€™t been there and didnâ€™t have an agenda building a sports network, then the financial outcome might not have been as great.â€

Subscription fees the key

Whew. NASCAR fans can breathe a sigh of relief now that their cable company or satellite provider will carry the new Fox Sports 1 network.

But NASCAR fans be warned: Donâ€™t breathe too easily. More hold-your-breath moments loom in the future.

Fans should expect occasional battles of wills between the networks that carry NASCAR and the companies that distribute content, and it all stems from the TV deals NASCAR finalized in the last month.

Who did you think is going to pay for Fox and NBC dishing out $8.2 billion from 2015-2024 for the rights to televise NASCAR races?

Some of it will come from advertisers. But much of it will come from the companies that deliver Fox, Fox Sports 1, Fox Sports 2, NBC and NBC Sports Network to the public â€” a public that will eventually pay for it through an increase in their cable or satellite bills.

ESPN earns an estimated $5.50 per cable subscriber per month, paid by the cable or satellite operator, who then passes that cost on to its consumers through subscription rates.

Speed, which will be replaced by Fox Sports 1 beginning this weekend, reportedly gets 22 cents a month, according to SportsBusiness Journal. Fox Sports 1 will feature NASCAR, major league baseball, college sports and UFC.

NBC Sports Network reportedly gets 31 cents a month, according to Bloomberg Businessweek. It will have motorsports from IndyCar to Formula One to NASCAR as well as the Olympics, the NHL and soccerâ€™s English Premier League.

If a network can attract 50 cents more per month, at 80 million subscribers, that works out to $480 million a year. Eventually, if they can attract $2 a month â€” just 36 percent of what ESPN gets â€” and 100 million subscribers, thatâ€™s $2.4 billion for a network before any advertising is sold.

So itâ€™s no wonder that networks will pay so much for NASCAR rights. FS1 recently paid $42-$50 million a year just for the rights to Big East college sports. NBC recently paid $83 million a year for EPL.

â€œThey see the ratings are down. Thatâ€™s almost a â€˜who caresâ€™ if you can achieve all your other targets,â€ said Pilson, now a consultant who advised NASCAR in its 2007-2014 deal but not for the one it recently signed.

ESPN and TNT, meanwhile, donâ€™t need NASCAR as much, Pilson said. Both networks declined to negotiate new TV contracts with NASCAR.

â€œESPN is not going to get a single additional home or probably drive its rate (higher) if it has NASCAR or doesnâ€™t have NASCAR,â€ Pilson said.

â€œThatâ€™s not true for NBC Sports.â€

Advertisers like sports

While subscriber fees rank as the main reason for high sports rights fees â€” Pilson said the general public appears willing to accept increases in their cable rates â€” other reasons exist why a network will pay so much for NASCAR.

NASCAR provides a significant amount of programming content, from practices and qualifying on Friday and Saturday to races on Saturday night and Sunday. The season, at nine months and 36 Cup races, is one of the longest of any sport.

The races still attract millions of viewers â€” the 2012 season averaged 5.8 million viewers per race â€” and NASCAR still ranks among the most watched sports each weekend. For 17 of the first 20 Cup races this year, NASCAR's rating was first or second among all sports that weekend.

â€œ(The sport) may not be going gangbusters but itâ€™s still in there,â€ said Mike Boykin of GMR Marketing, which has several NASCAR clients. â€œ(With) the emergence of two major sports networks, itâ€™s a solid property (helped with the rights fees). Theyâ€™ve got multiple ways to distribute the product.

â€œThe sport has got a lot of possibilities in addition to the live race. Itâ€™s a roll of the dice but the EPL deal was a roll of the dice (for NBC).â€

Advertisers love live sports because most people watch sports live instead of on DVR, which allows them to skip commercials. And live sports is among the few avenues for advertisers to reach young men through television, said David Campanelli of Horizon Media, which purchases television commercial time for advertisers.

According to Nielsen, 99 percent of sports in 2012 were watched either live or on the same day among fans ages 18-49. Thatâ€™s better than reality TV shows (85 percent), situation comedies (75 percent) or dramas (70 percent).

Front Row Marketing Services, a marketing subsidiary of NBC owner Comcast, has research that shows even a greater disparity. It reports that among viewers 18-49 from Sept. 24-Jan. 20, more than 95 percent of all sports events were watched within a week of their initial airing, compared to just 70 percent for comedies and 58 percent for dramas.

â€œGenerally speaking, live major sports (advertising) is easily the most expensive out there,â€ Campanelli said. â€œThereâ€™s absolutely a premium that you pay for live sports than you do versus any other programming.â€

Ratings for sports remain more stable than most prime-time TV shows so networks find sports a safer investment than in a showâ€™s creation.

â€œIn prime time, when a new show launches, it can be a big hit but more often than not itâ€™s a big miss and it goes away after two or three weeks,â€ Campanelli said.

â€œWhen youâ€™re buying sports as an advertiser, you know youâ€™re getting scheduled NASCAR ratings and the rating is pretty stable week to week, race to race, year to year and you can kind of bank on that rating and delivering that audience you were looking to deliver pretty consistently.â€

Thereâ€™s another big reason NBC wanted the rights for the final 20 NASCAR Cup races of the season. NBC wants to have NASCAR to go up against the NFL.

NBC wonâ€™t bank on NASCAR beating the NFL, but NASCAR will rate much better than other sporting events or other shows it could put up against football on a Sunday afternoon. It also will use its fall NASCAR coverage, including the Chase for the Sprint Cup, as a lead in to its â€œSunday Night Footballâ€ telecast.

â€œThey sat back in the boardroom and said, â€˜We need to build this channel. What is going to give us the most amount of eyeballs most often?â€™â€ Brown said.

â€œAnd NASCAR comes out right near the top when it comes to sports. They can own NASCAR in their window. You can own a night of football (but) NASCAR is on one channel once a week. That kind of exclusivity is what helps get them a premium for their rights fee.â€

Just how valuable is a sports network with live sports? Forbes estimates the value of the New York Yankees at $2.3 billion and the Brooklyn Nets at $530 million. News Corp. bought 49 percent of the YES Network â€” the channel that has the rights to the Yankees and Brooklyn Nets games â€” last year for $3 billion. In other words, the network is worth nearly double the two teams that anchor its programming.

By having NASCAR programming, Fox Sports 1 and NBC Sports Network â€” the Cup races will be split with 16 on network and 20 on cable â€” have increased their value, even combining to pay $820 million a year.

Now NASCAR has to hope that while it got a premium rate that its exposure doesnâ€™t take a hit by being on two unproven networks.

â€œWhy did NASCAR do it?â€ Pilson said. â€œWell, they did it for the money. And the expectation that over a period of time NBC Sports will get beyond 80 million (households) to 90 million to 100 million with their product driving subscription rates.

â€œIf youâ€™re the NASCAR fan and the big race is on NBC Sports Net and itâ€™s not carried by your local cable company, you think you might pick up the phone and complain about it? I suspect you will. Thatâ€™s the expectation.â€