It's a fascinating discipline. Typically for any given drug, large numbers of candidates are made. Those candidates are trivially different and go through a battery of tests for toxicity and efficacy. While there's a lot of science to it, the amount we know about biology is too primitive for it to be a pure engineering discipline. There's a certain amount of art to it because it's not enough to make the compound. You need to consider that if it works, some day a person is going to have to make it at scale, so it needs to be easy to make too. Finally, biology is surprising and messy so sometimes a gut instinct tells you to go a certain way.
I once was in a talk where one of the medicinal chemists who developed Amoxicillin described his excitement when they discovered the drug they had made had no taste whatsoever. The standard of care oral antibiotic that preceded it for brief period was horribly bitter (I forget the name). Kids hated taking the liquid form as a result. The team realized that with no innate flavor, the liquid form of Amoxicillin could be flavored with something more subtle than the typical grape or cherry flavors that they were accustomed to using to mask the flavor of drugs. He chose bubblegum.