The diagram above shows a section through the Earth (to scale). Moving from the outside in we have the atmosphere, shown here are the troposhere and stratosphere only, which contain the Earth's clouds and weather systems seen as a thin blue line (the atmosphere extends far above this, but as a thin cloudless sphere that is scarcely visible from space). Beneath this is the Earth's crust, another thin layer (varies from 5-70 km in thickness) is the Earth's rocky crust which contains the continents and holds the oceans on its surface. The crust is thinnest beneath the oceans (5-12 km) and thickest beneath mountains (up to 70 km).
Beneath the crust is the mantle, which is divided into the upper mantle (about 200 km thick, shown as the dark red region) which is further divided into an outer region of about 50 km depth, which together with the crust forms the rocky lithosphere. Deeper down is the asthenosphere where rocks are near to their melting point and where magma, which erupts from volcanoes as lava, is formed. The asthenosphere is a convective layer, where hot material rises and cooler material sinks as heat is transported from the hot lower mantle to the cooler crust.
Note, that although magma is generated here, the rocks are not liquid as many suggest, because the pressure is too high. Rather the asthenosphere consists of solid red-hot rocks that flow, rather like hot plastic. Lava is liquid because when this hot rock reaches the surface, the sudden drop in pressure allows the hot rock to liquefy.
Beneath the upper mantle is the lower mantle, which forms the bulk of the Earth, shown in orange-red in the diagram. The total thickness of the mantle is some 2885 km. The nature of the lower mantle is not well understood.
Beneath the lower mantle is the outer liquid core, shown in light grey, which is thought to be 85% liquid iron alloyed with sulphur and oxygen with some nickel.
At the centre of the Earth is the solid inner core (1216 km radius) which is mostly solid iron, but may contain some nickel. The pressure at the Earth's centre is estimated to be 4 million times atmospheric pressure and may be over 4000 degrees C in temperature! To describe the core as solid iron is a bit misleading, since at the enormous temperatures and pressures found at the centre of the Earth, iron becomes a very different material than the form we are more familiar with.
Why is the Earth layered (differentiated)?
The Earth formed from smaller particles that came together under the force of gravity (a process called accretion), in the early disc of material that surrounded the newborn Sun. Much of the gravitational energy is converted into heat during the process, so that the mass of accumulating material would have melted. This allowed the heavier materials, such as iron and nickel to sink down to the core, whilst the lighter materials, such as the silicates that make up most of the crust, floated on top of the melt and eventually cooled and solidified.
Why is the Earth's core so hot?
The Earth is hot because it was originally molten when it formed, but also because it has its own internal heat source which prevents the core from cooling down as it replaces the heat lost to outer space. This heat source is the natural radioactivity of the Earth's rocks. The radiation produced gets largely converted into heat.
How do we know what the Earth is like inside?
The chemical nature of volcanic rocks tells us about the upper mantle (lithosphere), but it is the analysis of Earth tremours and quakes that tells us most. When there is an earthquake or tremour, waves of vibration (seismic waves) travel throughout the Earth as it rings like a giant bell. Analysis of the characteristics of these waves tell us when they crossed boundaries and when they passed through liquid or solid. The crust-mantle boundary is called the Mohorovicic discontinuity (Moho) and the mantle-core boundary is the Gutenberg discontinuity. A discontinuity is a boundary where properties suddenly change, and the presence of these discontinuities reveal that the Earth is indeed layered. Nuclear test explosions can also generate useful vibrations to test finer details of the models. Finally, theory based upon the known laws of physics can be used to make predictions, and then the agreement or disagreement between observation and theory can be examined more closely and the theory refined.
The Earth's Dynamo
As the Earth rotates, its crust and mantle rotate at a different rate than the solid inner core. As a result, the liquid outer core is caught between two spherical surfaces that rotate at different rates and this sets up turbulence in the outer core, that is the fluid flow becomes chaotic and disorderly. Experiments have shown that when a liquid metal is under such turbulence, that it can generate a magnetic field similar in many ways to that of the Earth. It is therefore hypothesises that turbulence in the liquid metallic outer core due to the differential rotation of the mantle and inner core generates the Earth's magnetic field. This is reasonable, since we know that magnetic fields arise when positive or negative electric charges are in motion. For example, the flow of electricity through a wire generates a magnetic field around the wire. Liquid metals contain positive and negative charges and so the flow of a liquid metal is expected to generate a magnetic field. The Earth is rather like a giant bar magnet, with a magnetic North pole close to the geographic North pole and a magnetic South pole close to the geographic South pole. (The magnetic and geographic poles do not exactly coincide as the magnetic poles slowly drift as the magnetic North and South poles periodically reverse over thousands of years. The geographic poles coincide with the Earth's rotation axis). The magnetic field of the Earth stretches out into space as the magnetosphere.
Do not confuse the Earth's magnetic field with its gravitational field. Magnetism is produced by moving electric charges within the earth, whilst gravity is generated by energy of any kind. It is often said that gravity is produced by mass, since more massive objects tend to have stronger gravitational fields than less massive objects, however, the famous equation E = mc^2 tells us that energy (E) equals mass (m) times the speed of light (c) squared, so energy behaves as if it has mass and therefore generates a gravitational field. All forms of energy contribute to the gravitational field, the Earth's mass, its heat energy, its pressure, its viscosity, its magnetic field and gravity itself all generate the Earth's gravitational field. The gravitational field keeps you on the ground, the magnetic field makes your compass needle point to magnetic North.
(Tech note: Electric and magnetic fields always go hand-in-hand, since according to Einstein's theory of Special Relativity a magnetic field and an electric field are essentially the same phenomenon as seen from different inertial frames).
A dynamo is a power generator that converts rotatory mechanical energy into an electric current, and an electric current generates a magnetic field. Thus, the Earth contains a giant dynamo that existed long before human engineers discovered the same principle and used it to generate electricity in power plants.
Bot has written almost an entire textbook, with lots of pics, on the geology and physical geography of the Earth, including chapters about rivers, the water cycle, the atmosphere and weather, climate change, natural hazards and more, but this material is copyrighted (though not published) which unfortunately means that I can not share it with you here.