The way it dies depends on the size of the star. The largest stars end life with really big bang!! They explode sending dust and gas and stuff out through the universe. Some just puff up at the end, consuming and searing any planets that may be orbiting it. Most probably that is the way our sun will die and it should grow to the size of Earth's orbit. Yep, it will either burn us up or kick us out of the solar system. Not a happy time for ole Mother Earth.
Stars seem to put on a beautiful show as they die. Some leave behind what we call planetary nebulae. I am going to give you a little test. Below, I will post some pictures. They will all be of planetary nebulae except for one. That one will be a galaxy. See if you can pick out the real galaxy.
Good luck on my little spaced out test but do enjoy the beauty of our universe and have your self a very great day, you hear?