In ancient times, much of what passed for scientific theories was the result of philosophical arguments by analogy. So-called "natural philosophers" would use logic to decide how the physical world worked. But in the 13th century, Roger Bacon read the writings of certain Arab alchemists, which described a repeating cycle of observation, hypothesis, experimentation, and independent verification. These elements became the foundations of the modern scientific method.
First, a scientist observes a strange phenomenon, such as the fact that light reflects off a mirror. He then tries to explain why this happens by forming a "hypothesis". But on its own, this is just an educated guess. The scientist must carefully design experiments to test his hypothesis, using it to predict results. If he guesses right, the hypothesis might be correct. Other scientists will then repeat his experiment, or design their own new experiments, to further test the hypothesis. Over a long period of time, the hypothesis may become a bona fide scientific "theory" if it can successfully predict the outcomes of all those different experiments.
With the advent of powerful computers, scientists can now build computer models to help them design experiments and predict outcomes. Computer modeling is used in industry to design cars, bridges, or computer chips, for instance, and by biologists to find out how DNA molecules behave. Scientists collect lots of data by observing how things behave in the real world, and then enter this data into the computer. Because it can process information much faster than the human brain, the computer can sometimes see patterns in the data that scientists may have missed.
In the early 20th century, a philosopher named Karl Popper further refined the scientific method by insisting that any hypothesis must be capable of being proven wrong, in order for the results of an experiment to have any meaning. "Does God exist?" is not a good hypothesis, Popper explained, because there is no experiment that can be performed to prove or disprove God's existence.