This writeup contains a list of troubles your character can experience in a game of Nethack, and the ways I can think of to fix them. I've organised them according to how serious they are in the eyes of your deity. If your alignment is reasonably good and your luck is non-negative, then a successful prayer is guaranteed to fix all your major problems. Once your luck is high enough (at least 3) a successful prayer is also guaranteed to fix all your minor problems. So prayer will not be mentioned specifically in the remainder of this writeup.

Major troubles (in your deity's eyes)

Turning to stone
In addition to what Jeeves says, you can drink a potion of acid, or polymorph into any stoning-resistant monster.
Turning to slime
Polymorph into a fire elemental or green slime. Maximum magic cancellation will help prevent this problem.
Being strangled
For prevention, only try on noncursed amulets!
Stuck in lava
Teleport, level teleport, polymorph into something that likes lava, freeze the lava, or keep trying to walk out (you may not make it in time).
Sick
A few rather obscure cures: quaff a blessed potion of healing, quaff a potion of holy water if you're not chaotic, invoke the Staff of Aesculapius, eat a eucalyptus leaf. In Slash'Em, apply a medical kit, sit on or pray at a toilet, eat a holy wafer, or use the healing hands or surgery technique.
Starving
All you can do is pray or polymorph into something which can eat unusual things, such as a rock mole or xorn. The time to create food with stone to flesh is before you are too weak to cast it.
Lack of hit points
For your deity to recognise this as a trouble, your hit points must either be 5 or less, or 1/7 of their maximum value or less. If your hit points are rapidly dropping and prayer won't help, do NOT keep fighting in the hope that one last swing will kill it. Stop and think about what your best strategy for survival is.
  • Run away if you're fast enough, retreat into a corridor so that you need only face one enemy at a time, or teleport away. Level teleport, dig through the floor, or quaff a cursed potion of gain level, but remember, some monsters will follow you when you escape in these ways.
  • Heal yourself (with potions, spells, Slash'Em wands and techniques,...)
  • Engrave the mystic word Elbereth or drop a scroll of scare monster.
  • Kill the monsters with a powerful wand or spell, being careful not to be killed on the rebound yourself.
  • Disable your foes with sleep or paralysis, again watching out for rebound effects.
  • If all else fails, try random potions in the hope that they have healing properties.
Lycanthropy
Curable by eating a holy wafer in Slash'Em. The effects can be controlled with an amulet of unchanging or ring of polymorph control, and magic cancellation helps prevent it.
Stuck in wall or rock
A rather obscure trouble curable by teleporting, digging one's way out, or polymorphing into a xorn.

Minor troubles (in your deity's eyes)

Punishment
  • Dig a pit, place a boulder next to the pit, put the ball in the pit, and push the boulder in on top of the ball.
  • Read a scroll of remove curse.
  • Let a monster eat it.
  • Let a nymph steal it.
  • Polymorph into a metallivore and eat it, a nymph and remove it, or a noncorporeal monster and let it fall away.
Cursed items
See tips for getting rid of curses. Your deity treats cursed blindfolds and levitation items as a major problem. Be creative: there are many strategies you can use other than the standard remove curse and holy water.
Blind
Apply a unicorn horn, quaff any healing potion or a potion of see invisible, or eat a carrot
Lost stats
Apply a unicorn horn or quaff a (preferably blessed) potion of restore ability. Lost strength is deemed to be a major problem if you are strained or worse.
Wounded legs
Eat a lump of royal jelly or drink a potion of speed.
Stunned
Unicorn horn, lizard corpse reduces timeout, or wait.
Confused
Unicorn horn, read a blessed scroll of confuse monster, lizard corpse reduces timeout, or wait.
Hallucinating
Unicorn horn, or quaff a potion of extra/full healing or sickness.
Low magical energy
Your deity only recognises this as a trouble in Slash'Em. It can be cured by drinking a potion of gain energy, reading a scroll of charging while confused, or in Slash'Em, using the draw energy or power surge technique.

Troubles not recognised by your deity

There are three intrinsics which Nethackers sometimes see as bad but which your deity will not treat as problems to be fixed. They are uncontrolled teleportitis (randomly teleporting around), aggravate monster acquired by cannibalism or eating a domestic animal, and occasionally invisibility. The only way to lose these intrinsics is to play with a gremlin at night, which is not recommended as you will probably lose some useful intrinsics first.

However, these "bad" intrinsics can all be brought under control. Once you have teleport control teleportitis becomes a good thing. The effects of aggravate monster are not very serious and are negated by stealth. Invisibility is only a problem because it makes it harder for you to enter shops, and this can be solved by wearing a mummy wrapping.