A hangup occurs when you disconnect a terminal from the programs running in it. Originally, "hangup" referred to the process of ending a telephone call by placing (or hanging up) the phone on the hook. Some terminals connected to computers using phone lines (for example, with old DOS or Macintosh software like the communication modes of Microsoft Works or AppleWorks) and became subject to hangup. With windowing systems, you can now cause hangups by closing terminal emulators or DOS prompts with programs still running on them. With the Internet, you can cause a hangup by quitting your telnet or ssh client while still running programs. More generally, a hangup is any instance when a parent process quits.
If you hangup while NetHack is running, then (on systems with the SIGHUP signal, such as Unix, VMS and Microsoft Windows), the hangup function at save.c#line83 will save your game. For players who use NetHack's tty interface, an easy way to save the game is to close the terminal emulator or telnet client with NetHack's tty interface inside it.
Beware of hanging up during a prompt, as it has the effect of cancelling the prompt. You will not get a refund on your wish or genocide order. If you hangup after offering the Amulet of Yendor on the Astral Plane but before ascending, you will render the game unwinnable!
One of the listed bugs involves some method of using hangup to cheat. Cheating#Hangup_saves describes some ways to cheat using a hangup save. DevTeam member Pat Rankin provided some information about how this bug is fixed in the next version of NetHack in this UseNet post.
In NetHack 4, the game is saved continuously, meaning that a hangup has the same effect as simply quitting the game. When reloading the game, it returns to the exact same point (perhaps even at a prompt or in the middle of a turn) via replaying all user commands that were input since the last time the game could be saved in the normal way.