How do scientists know how the earth formed?
Science is a continuous quest to improve our knowledge. At best we may have workable theories, but nothing is “known” except (maybe) our observations.
So, what have scientists observed? We understand much of the composition of the earth from seismic testing, drill bores and geological formations. We see similarities and differences with other planets and spatial bodies. We observe galactic physics – orbits, momentum, mass, time and distance. From all of that we can create possible ways in which the earth was formed.