It was often used to run as fast as possible back to an ongoing encounter to be able to help again after dying. However, Blizzard decided that this was not an intended option to ease raid encounters so they introduced an instance block that prevents you from entering the instance in ghost form or alive while your raid is fighting a boss inside.
Since the same measures cannot be used for non-instanced raid encounters like Azuregos, most world bosses have special abilities to prevent corpse running. For example, if you die during an Azuregos fight you will get a debuff called Mark of Frost that will freeze you in place if you get within 100 yds of Azuregos.
There are however a few encounters that allow you to corpse run, e.g. the fight against Bloodlord Mandokir in Zul'Gurub where special Spirit Healers allow you to resurrect within the instance and without any resurrection sickness.
Corpse running can also be used to safely traverse high-level areas. If you run to a Spirit Healer at another graveyard and ask her to bring you back to life she will do so, but the resurrection sends you back to the graveyard at which you originally spawned as a ghost. However, if you log out and log back in, your character loses its association with that graveyard's spirit healer, so you will be able to return to life at the graveyard of the spirit healer you speak to. Thus, it is possible for a character to die in one zone, reach a spirit healer far away, relog, and resurrect safely at the nearby spirit healer. When relogging the minimap arrow () for the nearest spirit healer will also disappear.