What keeps earth from collapsing in on itself like at the end of a star’s life? Is it not big enough or what?
That is an excellent question, and the short answer is that you’re right, the Earth doesn’t collapse in on itself because it isn’t massive enough.
When you are considering some kind of large body, whether it’s a planet like the Earth or a star like the Sun, the force of gravity is always pulling everything that makes up the body towards its center. Gravity is therefore trying to collapse the body, and this collapse can only be prevented if there is some other force to resist gravity and support the immense weight of the star or planet. In the case of the Earth, the weight is supported by the resistance to compression provided by the materials (solids and liquids) that make up the Earth:
the pressure is sufficient to compress these materials a little, but the atoms that compose them repel one another and prevent collapse.
(The high pressures deep inside the Earth do have other interesting effects; for example, in the crust and mantle (which make up the outer2900 km (1800 miles) of the Earth), you see different sorts of minerals at different depths because each is only stable over a certain range of pressures. Also, while the outer core of the Earth is made of liquid iron, the inner core is solid due to the high pressures at the center of the Earth.)
With stars, however, things are different, due to their much larger masses. (The Sun, for example, is about 330,000 times more massive than the Earth.) During most of its lifetime, the weight of a star is supported by two forces. The first of these is the resistance to compression of the gas that makes up the star (just like a balloon will resist you if you try to squish it). Stars also support their weight by the radiation produced by the nuclear reactions that make them shine. Stars are powered by nuclear fusion–at first they will fuse hydrogen nuclei to make helium; as their hydrogen is used up,they switch to fusing helium to make carbon (if they are large enough), and so on up the periodic table to make iron (if they are very large). All of these nuclear reactions produce radiation in the form of photons, and the great number of these photons streaming out from the star’s interior creates an outward pressure that helps prevent the star from collapsing (as well as emerging as starlight at the star’s surface!).
As the star burns through its nuclear fuel, however, it is no longer able to support its weight with this radiation pressure. Nor is the regular gas pressure enough to hold up its outer layers, so at the end of its life a star collapses. How far it collapses depends upon its mass: relatively small stars (such as those the size of our Sun) will collapse to make a white dwarf (which is made of a plasma of nuclei and free electrons, and supports its weight by certain strange quantum mechanical properties of the electrons), while larger stars will form neutron stars (which are essentially giant atomic nuclei), and the largest stars are so massive that no known force can prevent their collapse, so they form black holes.