The only way to really test it would be through experiments deemed unethical.
The only way to definitively prove vaccines are both effective and safe would be to take a population living in exactly the same geographic location, with very similar genetic traits, and vaccinate one half of the population while leaving the other half unvaccinated and examining the effects among the vaccinated population.
The ethical problems with a study of this nature mean that it would never be permitted to take place. Until a study like this, it is impossible to determine if vaccines are safe or not.
While we may never be able to say with 100% confidence that vaccinations are safe (there are virtually no medications or medical procedures that meet that impossibly high standard), in the case of vaccines we must consider the risk vs the reward. We can see that vaccines provide a substantial reward by saving lives, reducing infection rates and contributing to the eradication of several dangerous diseases. By contrast, the risks are very low. There have been cases where the side effects of vaccinations have caused severe health problems. There have also been cases where the vaccines have aggravated existing pre-conditions. However, the rewards far outweigh the risks. We must, therefore, conclude that vaccinations are safe enough to use in medicine.
[P1] The only way to test if vaccines are safe would be to immunise half a population and leave another unvaccinated and see what the effects are. [P2] This is not ethical and will never happen. [P3] Therefore, we can never know.
[Rejecting P3] We may not know with 100% certainty but we can conclude that they are "safe", relatively speaking.