Textbook chemistry vs Real life chemistry and impurities Long ago when I took chemistry courses in high school and lower, chemistry seemed so simple and elegant. All equations and exercises involved pure elements, pure compounds, with a very clean simplified diagrams.

Now that I look at real world, the world is full of impurities. Even water we drink is not pure $\ce{H2O}$, but rather full of "other stuff", and no two samples of water are "absolutely identical". 

This makes me wonder. To what extent can you overlook these impurities when doing science, in predicting outcomes of experiments. 

For example, you can make naive formulas for how much salt can dissolve in water until it stops dissolving salt. However, in real world, 


Pure water does not exist as something easily available, and if it does, from what I read, it doesn't stay pure for very long.
Table salt, while mostly sodium chloride, often contains iodine, and "other stuff" that I am not sure about.


So surely these impurities impact the behavior of your experiments, and depending on the experiment, you can get reactions you never expected or wanted, or behavior can be drastically different.

My question is, how do scientists control experiments when dealing with unpure compounds? How do they know that their reactions to produce "table salt" don't create unwanted chemicals that will blow up in small quantities, or create some new kind of poison that they will only be noticed in a few days? Perhaps create some kind of acid that burns through the glass of their beaker or cause some other hazardous effects. Are they naive and ready to face the unexpected or are there absolute certainties in which they can control it (can you really control everything?)?
Well, scientists usually purchase the purest grade of chemical available if they want to use it for a reaction. (Leading to the absurd case that the less pure reagent grade is often dismissed for the purer analytical grade.) Usually, special care is taken for these chemicals to remove especially those impurities which could hurt most — you really don’t want any palladium in your sample of sodium bromide; that could do some really bad things.

That directly leads to a second point: No chemist would ever use ‘table salt’ or tap water unless in dire need. As you state, the impurities are basically incontrollable.

With that in hand, usually chemists have a good idea of what they just added and how that influenced the reactions. But often some things still go wrong. One of the most famous examples in organic chemistry is the Nozaki-Hiyama-Kishi coupling, which was initially reported as requiring only a $\ce{Cr^{II}}$ salt — usually $\ce{CrCl2}$. However, yields of other groups were much much worse than those originally reported by Nozaki and Hiyama. It wasn’t until eleven years after initial publication that — independently of each other — the original authors and Kishi both discovered that $2~\text{mol-}\%$ $\ce{Ni^{II}}$ are required as a co-catalyst for the success of the reaction. The original chromium salt batches of Nozaki and Hiyama were obviously contaminated by enough nickel(II).

An inorganic example I once heard of in a solid state chemistry course was a crystal structure published with experimentals in a solid state reaction. (I can’t remember the exact compound.) Other authors tried to reproduce the reaction but got much worse yields than the $100~\%$ that are expected in solid state reactions. The solution was that the square unit cell contained a hydride anion in its centre, almost invisible due to its low electron density. This hydride was introduced to the reaction from the silicon grease the authors used for the glass joints.