I discuss the formation and growth of the medium around massive
stars, especially Wolf-Rayet stars, and its impact on the evolution of the
resultant shock wave when the star ends its life as a SN. The circumstellar
medium is formed by mass-loss from the star during its various evolutionary
stages. Using analytical calculations and numerical simulations, I study
the evolution of this medium, multidimensional effects such as
hydrodynamical instabilities, and the onset of turbulence. When the star
explodes as a SN, the resulting shock wave will interact with this
medium. I further explore the impact of the ambient medium on the expansion
of the shock wave and the evolution of the remnant. Similarly, the impact
on GRB afterglows and absorption spectra of GRBs is considered.