(Patrick T. Fallon/Bloomberg)

Here’s how we think we discover powerful new medicines: Scientists dig deep into biology and zero in on a molecular Achilles’ heel that could disable a devastating disease, be it cancer or an infection. They concoct experimental drugs that hit the target. Then they conduct trials to find one that is safe and effective in people.

Here’s how we actually develop a surprising number of treatments: good old-fashioned observation, trial and error, and luck. Detailed scientific understanding of how a drug works often comes, ironically enough, near the end of the process.

“It’s sort of a fairy tale,” said Jon Clardy, a professor of biological chemistry and molecular pharmacology at Harvard Medical School, of the idea that drugs are born mostly from reason and not serendipity. “If you think of it as an aspirational goal, it’s fine.”

Understanding how drugs are developed matters crucially because the government and companies pour billions of dollars into the endeavor. But the dirty secret of modern medicine may be that the most logically alluring method for solving diseases – steadily accruing knowledge about human biology that we can act on  – hasn’t always been the best way to hit home runs. An older method of just slinging possible drugs at cells, animals -- or in some cases, people -- and watching what works has often been the more productive starting point, with understanding to come later.

“We’re not as smart as we look,” said Michael Jordan, a physician in the immunobiology division at Cincinnati Children’s Hospital Medical Center.

Knowing why a drug works has historically trailed the treatment, sometimes by decades. Some of the most recognizable drugs -- acetaminophen for pain relief, penicillin for infections, and lithium for bipolar disorder, continue to be scientific mysteries today.

A study published in the journal Science on Thursday neatly illustrates how understanding can trail success. Eight years ago, Jordan and colleagues in Cincinnati treated a 12-year-old boy who had been sick for years, suffering from a rare genetic disease that caused his immune system to wreak havoc on his lungs and guts. He came to the hospital to be evaluated for a possible bone marrow transplant that would fully replace his immune system, but he was too sick for the procedure. It was a palliative move when the medical team decided to give him abatacept, a drug approved for rheumatoid arthritis. The most attractive feature was that its side effects weren’t likely to make him sicker.

“We were expecting that he would likely die,”Jordan said. Six months later, the boy and his family came back – much improved. The medicine is far from a cure, but he is still alive today.

It's only now that Jordan and colleagues have figured out the scientific rationale for why the drug works. They've published the scientific details this week, and say it could lay the groundwork for a rigorous clinical trial – although nine patients have already been treated with the drug.

This is the sort of reverse of what you would expect under the model that is often presented to the public, but it isn't the first time Jordan has personally seen this process work in reverse. In 2013, he published a paper showing why another rare immune disorder, HLH, is successfully treated with a chemotherapy drug called etoposide. Successes with that drug were first reported in the 1980s.

“My own feeling is that there are many ways to discover drugs, and one of the mistakes we’re making at the  moment is just trying to think there is one way and focusing on that,” Clardy said. “And I think what past certainly and current experience are showing, is drugs can be discovered in a bunch of different ways and you should be open-minded.”

Even in the dawning age of precision medicine, where sophisticated understanding of human biology and the genome is supposed to give scientists a leg up on disease, the most rationally designed drug still requires a little human ingenuity. More than a decade ago, a promising lung cancer drug was designed to inhibit a gene thought to be crucial for cancer. It failed, except in a small fraction of patients. That led doctors to study those patients and learn that their cancers were being driven by a mutated version of the gene.

Daniel Haber, director of the Massachusetts General Hospital Cancer Center, quotes Louis Pasteur, the scientist who had the insight that germs carry disease: “Fortune favors the prepared mind.”

“If you think you're too smart and you only do what is scientifically indicated, there’s always going to be something, 'Oh my God, we never thought of that!'” Haber said. “If you half-know what you're doing, then you're better prepared to understand or appreciate discoveries that are serendipitous in some way."

A 2011 study reviewed a decade worth of drug approvals found that of 75 drugs that worked in a completely new way, 28 came from the more old-fashioned method of screening drugs against cells or animals, and 17 were built from detailed understanding of how the disease worked. David Swinney of the Institute for Rare and Neglected Diseases Drug Discovery said that despite the fact that far more resources are devoted to developing drugs by focusing on targets, the older method of screening has been more productive by his analysis.

A naysayer might question why, in that case, it’s even important to know how medicines work. But that’s because refining drugs and getting more effective or less toxic versions can depend on those insights. That’s what drives Thomas Bernhardt, a Harvard Medical School scientist who last year published a paper in Cell showing how penicillin, the wonder drug of more than a half century ago, works. The traditional understanding has been that the drug interfered with bacteria's cell wall, causing the germs to burst. But Bernhardt found that in fact, the drug also puts the bacteria into a futile cycle of building and tearing down cell wall components that it can't use -- he compares it to throwing a wrench in an engine.

That may seem like a scientific curiosity, but there's real utility to unraveling the mechanism of a drug -- eventually.

“If we’re trying to develop new antibiotics, as a group of scientist and an industry as well, how can we expect to be as efficient as we can at going about it, when we don’t understand how our old antibiotics work," Bernhardt said.

Robert Raffa, a professor of pharmacology at Temple University School of Pharmacy, has spent time trying to figure out how a drug found in most people’s bathroom cabinets works: the medical mystery of Tylenol.

“We can eliminate things. It is not obviously morphine-like, it is not obviously aspirin-like, and it seems so we’re beginning to narrow it down," Raffa said. "Here’s why it’s very, very important: It’s because the other options for pain relief are not optimal, by a long shot."

Drug discovery does sometimes follow that neat progression, but even when a drug starts with a coherent scientific idea about what the drug is supposed to do, twists in the road can seem like the norm. Erectile dysfunction drugs had their origins in the side effects of a blood pressure drug. Thalidomide was infamously used for morning sickness before being pulled from the market and then rescued to be used as a drug in cancer and leprosy.

In an age of ubiquitous biological information, it can seem that insight will lead us to new drugs, but it may be important to keep in mind how much we don't know.