Once a red giants core has run out of hydrogen fuel to fuse into helium, the core will collapse. The outer layers will expand and helium fuses into carbon within the core, as the temperature increases, heavier elements will form, usually up to iron.
First, we'll talk about red giants!
Eventually, the outer layers will drift from the core's gravity and out into space, causing a planetary nebula. From there the core becomes a white dwarf and will become a black dwarf when it cools.
Small stars will last billions of years while large stars will only last around a million.
Now for red super giants, they also have nuclear fusion and that stops when iron has formed. However, they don't break up like red giants do. Red supergiants release most of their mass through massive explosions.
Those explosions are called supernovas.
You really like stars, yeah?
A supernova is the biggest form of explosion in the universe and can form elements like uranium and gold. If a supergiant is 8-20 larger than the sun it will become a neutron star, which is a superdense core made of neutrons or if it's 20 or more times larger than the sun it will become a black hole.