You have to research your target market, meaning who is that market, what channels do they watch? On what days of the week and at what times? What does this market like about your product already? What features of your product would appeal to that market? Your company would already be working with a media buying company or an ad agency to answer some of these questions in conjunction with your marketing department.
Then, either that department or an outside production company writes and produces a commercial. Once your company approves it, that part is the same as producing any film or video, with actors, directors, grips. PAs, location, contracts, etc. And then the commercial is edited, music tacked on, graphics put in, etc. etc., just like any ordinary production.
Once production and post-production are finished, the media buying company/ad agency contacts the networks you want to show your commercial on and negotiates a price for a certain number of showings during certain time periods (or as it’s know in TV-land, a daypart) for a certain amount of time, say 4 times an hour from 12p-3p on Saturdays for 9 months for Valvoline, or something like that, because they know the target market will be watching NASCAR. Do you see? Outside companies take at least 15% of the total fee you’re paying to the network on top of what you’re paying the network.
National ads for corporations get more exposure and time on the air because they can afford to pay for it. It’s an economy of scale thing. The local car dealership in your town, for example, probably has a standing deal with the local stations to have an ad on in the middle of the 6pm newscast and they just renew it every year. Different types of ads have different deals.
I used to work in TV and corporate media. It’s amazing, we didn’t cover this in my TV classes at uni at all. You learn it by osmosis once you work in the business.