The Earth is supported against the gravity pulling it inward by the incompressability of the solids of which it is made. A star like our sun has no solid core to support it; instead, it is supported by the pressure of hot gases. The gases are kept hot by nuclear reactions, in particular the fusion of hydrogen into helium in the extremely hot, dense gases at the core of the star. In time (billions of years for our sun) all the hydrogen in the core will be used up, and the core will be all helium. When that happens the core of the star begins to shrink under the force of gravity. As it shrinks it is compressed and heats up even more. A series of rather complex events then occurs: gas around the core that had not been hot enough to support hydrogen fusion and thus still has hydrogen left becomes hot enough to ignite fusion reactions in a shell surrounding the shrinking core, meanwhile the core itself can shrink until the temperature and pressure are sufficient to start fusion of the helium into carbon. If the star is massive enough the core will become all carbon and shrink again, then begin burning carbon into yet heavier elements, and so on until all the atoms in the core are converted to iron. Fusing iron is the end of the road, however, because fusing iron into yet heavier elements does not release energy (just the opposite, it takes net energy). While all the complicated stuff is occurring in the ever smaller, denser, hotter core, the relatively light, cool outside gases expand and cool. The color of a star is determined by how hot the outer envelope of gas is. Very hot gases glow blue-white, medium hot glow yellow, and "cool" (still thousands of degrees!) gases glow red. So while the core of the star shrinks and becomes hotter and hotter, the rest of the star expands and forms a bloated star called a red giant. For star much more massive than the sun, the appearance of the star can change radically as various parts of the core start and stop burning gases on the road to converting everything to iron. I'll just skip over these complexities. The end point of these late stages of the stars life depends on how massive the star is. At some point the shrinking core will, in a sense "solidify" into degenerate matter -- this is a peculiar state of matter that is much, much denser than ordinary matter and extremely resistant to compression. If the mass of this core is less than a certain mass, called the Chandrasekhar Limit, the resistance of the degenerate matter will suffice to halt the contraction of the core. The result, for a star like the sun, is a white-hot object about the size of the Earth but with the mass of a star, surrounded by a tenuous, red-hot atmosphere larger than the orbit of Mercury. For a star like the sun the core will be mostly carbon. When the core stops shrinking because it has become degenerate, the outer layers are compressed even more as they collapse onto the now-solid core. The new configuration is unstable. Eventually it blows up and the outer parts of the star blow off exposing the super-hot core, which is called a white dwarf star now. The plentiful ultraviolet light from the new white dwarf keeps the expanding gas clouds ionized and glowing: the result is a "planetary nebula". In time the nebula will expand a dim into invisibility. The white dwarf will gradually cool, since it is no longer fusing anything. Given long enough it is expected that white dwarfs will cool off completely and become black dwarfs, but the universe is not old enough for this to have happened yet. If the mass of the shrinking core is larger than the Chandrasekhar Limit degeneracy pressure will not suffice to stop the core from shrinking. What happens then is very complex in detail but simple in the basics -- the core collapses faster and faster until the ever-faster burning of ever-bigger nuclei can't keep up, then the "bottom drops out" and the core free-falls into one of two end stages. For cores less than about 3 solar masses (not known very well) the collapse is halted when the core converts to what is basically one giant atomic nucleus with the mass of a star and a diameter of a kilometer or so. This solid chuck of neutrons is called a neutron star and is a very peculiar object indeed. In the process of shrinking from the size of the earth to the size of a smallish mountain, a fantastic amount of gravitational energy is released very quickly. The resulting explosion is called a supernova. The neutron star is surrounded by the hot remains of the rest of the star, called a supernova remnant. For cores above 3 solar masses an even stranger object is produced, a black hole.
Whew, that's a lot to absorb. You can find some of the details by looking up the italicized terms in Wikipedia. I may have mis-stated some of the details since I wrote this off the top of my head.
Good luck with your research!