When a star as big as the sun reaches the end of its life, it turns into a planetary nebula

The classic example is M57: The Ring Nebula

Credit: H. Bond et al., Hubble Heritage Team (STScI /AURA), NASA

M57 is a planetary nebula. Hot blue gas near the energizing central star gives way to progressively cooler green and yellow gas at greater distances with the coolest red gas along the outer boundary.
The star blows away its outer layers, so almost all the ones we knew look like this.
or like this

But now we have all sorts of weird shapes.

This is the Cats-eye nebula
Planetary Nebula Mz3: The Ant Nebula

Credit: R. Sahai (JPL) et al., Hubble Heritage Team, ESA, NASA

Explanation: Why isn't this a big sphere? One possible answer is that Mz3 is hiding a second, dimmer star or that the central star's own spin and magnetic field are channeling the gas.
XZ Tauri

Credit: John Krist (STScI) et al., WFPC2, HST, NASA

Why is the binary star system XZ Tauri emitting a hot bubble of expanding gas? The Hubble Space Telescope shows this in three photographs over the past five years. XZ Tau is composed of two very young stars separated by roughly the same distance as between our Sun and Pluto.
Planetary Nebula CRL 618

Credit: Susan R. Trammell (UNC Charlotte) et al., ESAIC, HST, ESA, NASA

A few hundred years ago CRL 618 appeared as a modest red giant star. Since then it has run out of core material to fuse and so has started to become a planetary nebula. CRL 618 is evolving quickly, expelling hot gasses in complex jets
Eta Carinae

Credit: J. Morse (U. Colorado), K. Davidson (U. Minnesota) et al., WFPC2, HST, NASA

Eta Carinae may be about to explode. About 150 years ago it underwent an unusual outburst that made it one of the brightest stars in the southern sky. It is the only star currently thought to emit natural LASER light. This
The Crescent Nebula

Credit: Brian D. Moore (ASU) et al., WFPC2, HST, NASA

is a rapidly expanding shell of gas surrounding a dying star. It began to form about 250,000 years ago as the central Wolf-Rayet star WR 136 began to shed its outer envelope in a strong stellar wind, expelling the equivalent of our Sun's mass every 10,000 years. The Crescent Nebula, lies about 4,700 light-years away in the constellation of Cygnus and can only be seen through a telescope. It will probably undergo a supernova explosion sometime in the next million years.
NGC 2440

Credit: H. Bond (STScI), R. Ciardullo (PSU), WFPC2, HST, NASA

:a white dwarf star begins its life by casting off a cocoon that enclosed its former self. The planetary nebula designated NGC 2440, contains one of the hottest white dwarf stars known. It can be seen as the bright dot near the photo's center.

IC 4406:

Credit: H. Bond (STScI), R. Ciardullo (PSU), WFPC2, HST, NASA

How can a round star make a square nebula? IC 4406 is most probably cylindrical, with its square appearance the result of our vantage point.
Supernova Remnant E0102-72

Credit: X-ray (NASA/CXC/SAO); optical (NASA/HST); radio: (ATNF/ ATCA)

The shape of supernova remnant E0102-72, however, is giving astronomers a clue about how tremendous explosions disperse elements and interact with surrounded gas. The above image is a composite of three different photographs in three different types of light. Radio waves, shown in red, trace high-energy electrons . Optical light, shown in green, traces clumps of relatively cool gas that includes oxygen. X-rays, shown in blue, show relatively hot gas that has been heated to millions of degrees. E0102-72 currently measures 40 light-years across.
HH111's 12 Light-Year Star Jet

Credit: Bo Reipurth (CASA/U. Colorado) et al., HST, NASA

The complex interactions of three stars in the Orion B molecular cloud complex have resulted in the ejection of particles along a 12 light-year long jet. One of the stars in the HH111 system has apparently also been ejected leaving two stars tightly bound in a binary orbit. The spectacular jet emanates from one of these two stars.

and finally some galaxies