As mentioned in an earlier part of this explanation of what is Formula 1, some of the teams spend nearly half a billion dollars making their cars every year. This is the most expensive form of racing because the teams DO have to build their own cars. Unlike many other series of open-wheel racing, where a team may be able to buy a chassis for less than a million dollars from a racing car manufacturer, in Formula 1, teams have to pay for a staff of highly qualified engineers and technicians to build a car from nothing. They all build their own car.
The sport has a massive number of sponsors providing teams with this money, since the sponsors know that hundreds of millions of television viewers watch Formula 1 races around the world every year. This is huge exposure. The result is that the principle sponsors of some of the biggest F1 teams pay up to $50 million per year to have their names plastered onto the cars. This is why Formula 1 cars are often called the world's fastest billboards.
In addition to the cost of the cars, each F1 team sends staffs of around 60 people to each race to prepare the car, run the media operation, do sponsorship activities, etc. That requires a lot of money. Moreover, teams employ up to 1,000 people at their factories to take care of business and build the cars.
Finally, the drivers are paid millions, particularly the best of them - as mentioned earlier in relation to Michael Schumacher's $80 million earnings.