Its complicated but cheating can originate anywhere along the line. Testing for banned substances in big international events is similar to DNA testing. Once a sample leaves the stadium/arena it is supposed to be protected, a “chain of custody”, if you will. Mislabeling can happen, cross contamination can happen, sloppy lab work happens. Then, sometimes a banned drug is hard to detect or can be disguised. Sometimes a competitor slips something in another athlete’s food or beverage to eliminate them from a competition. There is a whole list of banned over the counter medications but ocassionally one that is not on the list turns up. If an athlete is unaware that an OTC med has a miniscule trace of an illegal substance and take it too close to their competition the test will come back positive.
Well geez, that really puts a damper on athletic competitions. How can we really know if a win is fair? Another reason to not be excited about the olympics.