Lightning contains a lot of energy, so where does this energy go after lightning has hit the ground?
Does it travel all the way to the core? What happens after that?
The majority of the energy is dissipated in the travel through the air from the cloud to the ground. The energy goes into heating the air and generating the shockwave that we hear as thunder. I can't give you a single definitive refernce for this, but Googling "energy dissipation lightning" will find lots of relevant articles.
You can understand why this is because the energy dissipated by a current $I$ travelling through a resistance $R$ is given by $W = I^2R$. In a lightning strike the current is constant, because the charge flowing in one end has to flow out the other end, so the power dissipated is proportional to the resistance. The resistance of air is a lot higher than the resistance of the ground/tree/person or whatever the lightning hits, so the majority of the energy dissipation is in the air.
The electrons flowing from the cloud through the lightning bolt end up in the ground, but with an energy only slightly greater than ambient. They will presumably flow into the surrounding area until the potential difference around the point of strike falls to effectively zero. This is likely to be within a few metres, so they wouldn't get anywhere near the Earth's core.
Lightning is generated by dielectric breakdown of air. So it is essentially a collection of electromagnetic waves. Now any material on earth has a notion of permittivity and permeability attached to it. Now when the electric field corresponding to the EM wave touches the surface of earth then depending on the nature of surface one can write down maxwell's equation, with proper boundary condition. And then calculate the transmitted electric field whose magnitude gets attenuated with distance.