Hanging was a method of execution used on Earth and other worlds. Often hanging involved having the condemned stand on a platform. A rope was placed around the condemned's neck and the platform was removed, or a door was opened underneath the condemned allowing him or her to drop several feet. Death occured when either the person's neck was broken or the person was asphyxiated.
On a pre-warp planet, the primary species practice hanging when there were spies. The SS Enterprise's captain, Jonathan Archer and his armory officer, Lieutenant Malcolm Reed were sentenced to hang, believing that they were alliance spies. (ENT episode: "The Communicator")
On a world populated by the descendants of humans kidnapped from Earth in the 19th century, several humans led by a man named Bennings hanged a Skagaran after the death of Clay Stanton. (ENT episode: "North Star")
For Cardassians, a hanging acts dually as a form of torture and an execution. Because of the Cardassians' thick musculature around the neck, it takes some time (as much as a few days) for a hanging to kill the subjects.