It's not, but it's hard to argue that TV advertising is (or was until very recently) a great way to get your drug's name out to the public. It's hard to research something you don't know about, especially before the Internet was commonly available.
Of course, the drugs with ads are usually the most expensive name brand drugs that will earn the pharma companies a lot of money.
In the UK, we don't see a drug on the TV (other than headache tablets and cough syrups) and then demand our doctors prescribe them. We visit a doctor who makes a diagnosis and prescribes the appropriate medicine, if necessary.
Of course, the drugs with ads are usually the most expensive name brand drugs that will earn the pharma companies a lot of money.