Very good question 857drud47!
The development of a medicine has to go through a number of phases of clinical development before it can be approved for commercial sale and gathering data on adverse side effects is part of that process.
Firstly you need to have a model in animals that gives a potential therapeutic effect exists for treating a particular disease.
Secondly you would typically test the molecule on healthy adult male volunteers to show the medicine is safe
Thirdly you would treat adult patients that have the disease to show that the medicine does work (a basic proof of concept)
Fourthly you would finalise the intended commercial strength and pharmaceutical form and treat a larger population of patients with the disease to prove there is a real benefit of marketing the medicine.
If all this works you can apply for a licence from the relevant regulatory body in a particular country to commercially sell the product.
To go through the stages above will typically take 10-15 years. There will always be some less severe side effects and you are required to let the patients and doctors know that these can occur on the patient information or on the summary of product characteristics but hopefully by the time you have a commercially approved medicine you are confident that the benefits will outweigh the risks.