Someone you trust tells you. Gould's The Panda's Thumb, Ch. 19 has a discussion of the concept. Start with some first principles and use logic to come up with new facts. Unfortunately, if the first principles are bad, all of your reasoning will be for naught.
Rationalism has a place in science, but it has to be combined with the next part.
If A causes B, then A and B ought to appear together, and A ought to come first. For example, if alcohol causes intoxication, then when I see people drinking, I should see intoxication, and drinking should come first. This is also called the correlational approach. This is also called the experimental method. It's an invention, and an important one.