Here is why drugs cost so much money....
You start with a disease you need a drug to treat. You spend a few years of lab research to figure out what causes the disease. You find a 'target' that when blocked, prevents the disease. You develop a way to measure if the target is blocked in a test tube model. So, you have probably invested 4-5 years of lead time and early assay development. It might take another 2 years to miniaturize the assay so you can screen lots of chemicals. Once you have an effective assay in the microscale required for a drug screen, you can start work.
Looking for drugs is done by random screening. You take a library of chemicals, maybe 3 million of them, and put each one on your assay to see if it blocks that 'target molecule'. A full screening campaign might take 3 weeks of robot time and cost upwards of half a million dollars. This effort typically identifies a few thousand chemicals that block the target. Each of these is run through secondary assays to rule out off target effects, bad pharmacology, etc. to arrive at a single 'lead molecule'. The lead molecule is usually not potent enough to be a drug yet. You might spend a year on optimizing the 'lead molecule' via chemical modifications to improve activity and learn what parts of the chemical are important. With this effort you get an 'optimized lead molecule'. This then goes to medicinal chemistry to make it more soluble and bioavailable, and make sure the compound doesn't have adverse metabolism or toxicity. Medicinal chemistry development might take another year or so. You now have a 'drug'.
Next the drug goes into animal models for efficacy on the disease and toxicity testing. Also, animals are dosed with the compound and monitored for adverse effects. If everything looks OK from this, the compound heads off to the FDA for application permits to start a small clinical trial. You get some people with the disease and run a very small test on them, to see if the drug works, if there are side effects, and how the drug is absorbed. Once you have the dosing down, and see no problems, the drug proceeds to a larger clinical trial to see how well it does against lots of people with the disease. If that works, you do an even larger trial, and finally, you move to a multiple center phase III trial in tens of thousands of patients. If everything looks good, you collect all this data and send it off to the FDA for approval. The approval might take 3-4 years, and often results in additional clinical trials to evaluate any side effects that were seen. If all goes well, you get an FDA approved medication you can sell.
If you are lucky, your company filed many patents on the drug, and your competitors have nothing similar (like a better drug that hits a different target). You get about 7 years of on patent time to recover everything you spent so far. This is typically about 500-600 million dollars so far. You also have to cover the costs of all the failed drugs that you put through the process above, but fail somewhere along the way. For every 500 lead optimized compounds that go into a clinical trial aspect, maybe 1 comes out as an FDA approved medication. This might cost another 300 million dollars or so. When you add in manufacturing costs, patents, salaries, etc., the new drug has to make a BILLION dollars before you make a dime. And you need it in 7 years before a generic manufacturer starts making a copy of your medication.
Big pharma would actually makes more money just investing their cash in stocks and bonds. I was just involved in killing off a drug in phase II clinical trials where a company had already invested over 400 million dollars in development work.
On TV, scientists look at a picture of the target and point where a drug would bind, then make a drug to stick on the target. Reality is, science sucks at this 'rational drug design' and almost every drug out there is found by the iterative random screening method I outlined above.