How did scientists discover the internal structure of the earth?
The most common seismic waves are S waves and P waves. While S waves have more energy, they can only move through solids. Also, they are quite slow compared to other waves. On the other hand, P waves are faster and have less energy, but they can move through all three states of matter.
Since we have earthquake detectors, we use the detectors to figure out if there is a difference in speed. P waves are slower in liquid than in a solid.
Using these differences and calculating the difference in speed when a wave refracts to another state, we can infer what is inside the earth. The mantle was a solid, the outer core was a liquid, and the inner core was a solid.