Hypothesis testing is used to determine if a treatment has an effect by ruling out chance as an explanation for study results. It involves taking a sample from a population, administering a treatment, measuring outcomes, and comparing the sample to the original population. If the sample is noticeably different, it provides evidence the treatment had an effect. However, differences could also be due to sampling error. Hypothesis testing decides between two explanations: the difference is due to sampling error or the difference is too large to be due to chance and indicates a treatment effect.