Damage in NetHack reduces the current hit points of the monster or player that receives it. If the player or a creature is reduced to 0 or fewer HP, it dies. Exception: if you are a monster (due to polymorph or lycanthropy) and you're reduced to 0 or fewer HP, you revert to your original form (unless you are wearing an amulet of unchanging, in which case you die).
Damage can come from a variety of sources, including physical and magical attacks, as well as falling down stairs or onto a sink, stepping on a trap, being hit by a bounced or reflected spell, and many others.
Damage from some spells and effects can be reduced or eliminated by having the appropriate resistance, magic cancellation, or magic resistance, or by having the half physical damage or half spell damage intrinsics.
The damage that a weapon, attack, or other occurrence can do is often specified in D notation (e.g. striking with a weapon that does 3d6 damage will deal damage equal to the sum of 3 rolls of a 6-sided die on every successful attack).