How did the components of the earth come together to form the planet?
Earth was formed from a lot of small protoplanetary bodies.
The Earth and other planets were formed in a protoplanetary disc of material orbiting the sun. Small solid grains of material collided and merged to form protoplanetary bodies. Theses in turn collided and merged to form increasingly larger bodies. Ultimately there is a single body in each orbit which is a planet.
The collision processes which formed the Earth would have generated a lot of heat. The early Earth would have been in a molten state. Heavier elements such as iron and nickel would have sunk to form the core. Lighter elements and compounds would be nearer the surface.