When a star like the Sun runs out of fuel, it expands and its outer layers puff off, and then the core of the star shrinks.