Giant stars have a very different fate. They are massive enough that the helium ash ignites and burns to carbon, the carbon ignites and produces oxygen, and so on until it reaches the point of having a silicon shell that is producing iron. An iron core begins to accumulate. The star resembles an onion inside. Iron, too, will fuse, but it will absorb energy in the process; it will provide no support for the star. When the iron core reaches Chandrasekhar's Limit of about 1.4 solar masses it collapses in on itself. Gravity wins. Get enough mass together in one lump and gravity can overcome any other force in the universe.
As the core temperature soars to 10 billion K, the iron atoms are torn apart by photons until only protons, electrons and neutrons remnain. The protons and electrons combine to make more neutrons. The collapse proceeds in seconds to the point where the neutrons are packed together like marbles in a can. Quantum forces step in and stop the collapse at this point, called neutron degeneracy. There several hypotheses about what happens next. What is known for sure is that a monstrous explosion blows off the star's outer envelope in a Type II supernova event. This is the core collapse supernova. It is one of the most violent events in the universe.
The reason for the explosion has been the subject of a LOT of theoretical study. After all, why should a COLLAPSING core blow the star apart? Theoreticians have considered at least these possibilities.
Type II explosions are easily identified by the presence of hydrogen in the spectrum of the exploding star. The outer envelope contains a lot of hydrogen, so it shows up in the spectrum. This contrasts with the Type Ia supernova, which does not show significant hydrogen.
The Type II supernova leaves behind two remnants.
We know that supernova explosions of both types occur; they are observed in some numbers. The last blast anywhere near us was seen about 400 years ago, but they are seen every year in other galaxies. They are so bright that they are easily visible at those great distances. Spectral analysis reveals which type of event it is.
Your book did not mention what happens to a low-mass star like an M dwarf. These little stars are very small and very dense. They burn their hydrogen so slowly that they can last 300 billion years. Their density is so high that heat from hydrogen burning cannot get out by radiation, as in the Sun. Convection rules and these little stars are completely convective. Their material is well stirred up. This means that they can burn most of their hydrogen.
As the star ages (300 billion years or so!), the hydrogen fraction decreases until hydrogen burning finally slows and stops. The star is now a dwarf star sized ball of helium. What happens next is not intuitive. Its fuel exhausted, the star begins to get hotter! It's not magic - once hydrogen burning stops, gravity takes over and shrinks the ball of helium, which makes it heat up. This goes on until it reaches a state of degeneracy and becomes a stable helium white dwarf.
Here is a Web page that contains an MPEG file showing an evolving star. There is also an audio component to listen to.
And yet another. This site contains a number of simulations. Shows stars of different masses.