''Demogorgon, the prince of demons, wallows in filth and can spread a quickly fatal illness to his victims while rending them. He is a mighty spellcaster, and he can drain the life of mortals with a touch of his tail.''
Because Demogorgon's attacks make you deathly sick, he is generally regarded as one of the nastiest monsters in Nethack and Slash'EM. There are other monsters with sickness attacks, but they all have vulnerabilities which make them easier than Demogorgon. (Rot worms are slow, Juiblex can be defeated with a wand of digging, and Pestilence and Scorpius are vulnerable to death rays.) In addition to his sickness attacks, he is a high-level spellcaster, able to cast such spells as ``summon nasties'' and ``randomly curse items''.
Demogorgon has two sickness attacks per move, but if the first one succeeds the second one will be converted to a stun attack. His first attack will leave you with between 20 and (19 + Con) turns to live. Subsequent sickness attacks will reduce your time to live by a factor of about three. To be precise, each attack will divide your time to live by 3 (rounding down) and then add 1.
The word ``turn'' here refers to game turns, which are displayed on the bottom line if you have the time option set. A turn consists of one or more moves for the player and one or more moves for the monsters, the exact number of moves depending on their speed. The player and the monsters alternate moves during the turn, but either one may get some extra moves at the end.
A very fast and unburdened player will get to make an average of 5/3 moves every turn, and will always get two moves in a row the turn after they had a single move. Demogorgon will normally get two moves in a row once every four turns, but if he casts ``haste self'' this will increase to two of every three turns. Thus on average, a hasted Demogorgon is as fast as a very fast player, but Demogorgon gets his extra moves on a regular cycle, while the player gets theirs somewhat at random.
After taking two swings at Demogorgon without healing yourself, you will usually have only one or two turns to live, and will need to cure your sickness immediately. Here's an example of how it works. Note that the player's first move is not an attack but a heal (or perhaps moving next to Demogorgon at the start of the fight).
You move (to heal yourself or approach Demogorgon).
Demogorgon stings! Your time to live is now 20.
Demogorgon stings! Your ttl = 7.
The turn ends. Your ttl = 6.
You attack Demogorgon.
Demogorgon stings! Your ttl = 3.
You attack Demogorgon.
Demogorgon stings! Your ttl = 2.
The turn ends. Your ttl = 1.
The above is a worst-case scenario, in that Demogorgon got four moves in the two turns and you only got three, but it doesn't really matter, because three stings and the end of a turn are enough to bring your ttl down to 2. If your initial ttl was higher than 20, then it's possible that you will survive longer, but there is no way of determining your ttl.
What all this amounts to, assuming that you are very fast and unburdened, is that if you get into a regular cycle of taking two swings at Demogorgon and then using a 100% reliable method of healing yourself (such as the spell of cure sickness at 0% failure), then his sickness attacks will never kill you. However, he is also capable of doing severe hit point damage, and some of your opportunities to swing at him may be wasted on removing stunning from his stun attacks or confusion from any summoned umber hulks. You are strongly recommended to wear an amulet of life saving while fighting him.
In vanilla Nethack, Demogorgon only appears when something else summons him, and many people have had several ascensions without ever encountering him. In Slash'EM, he has his own level in Gehennom, so you will have to face him. This spoiler was written for Slash'EM, but parts of it may also be useful for vanilla Nethack.
It is possible to turn Demogorgon to stone by hitting him with a cockatrice corpse or egg or polymorphing yourself into a petrifying monster (preferably a tough one such as a basilisk) and letting him sting you. Some people wish for a cockatrice corpse once they realise they are on his level. If you're out of wishes and do not have polymorph control, sometimes he will summon a cockatrice himself.
Demogorgon can be paralysed with a potion of paralysis, but make sure you are wearing a ring of free action. Don't throw the potion, as it will very likely miss. Instead, wield it against him to guarantee a hit.
You can also polymorph into a black dragon and disintegrate him, or use a ring of conflict to get your pet black dragon to breathe disintegration at him.
If you happen to have Houchou (an artifact spoon of insta-destruction), you could throw it at Demogorgon.
Demogorgon respects the mystic word Elbereth, so you could engrave it on the up stairs with a wand of fire or lightning. If you use any other engraving tool, the Elbereth will not be permanent and you will have to levitate above it to avoid smudging it. See Kate Nepveu's Elbereth FAQ for more information about Elbereth. Standing on a scroll of scare monster will also protect you, and you won't need to worry about eroding it.
A potion of invulnerability does not protect you from becoming deathly sick or dying from your illness, although it protects against the hit point damage.
On the subject of strategies that don't work, Demogorgon is completely untameable, has such high magic resistance and level that it is impossible to pacify him with charm monster, and cannot be summoned by sacrificing your own race.
To defeat him in combat, you'll have to stop him teleporting away to heal himself. The way to do this is known as the upstairs/downstairs trick, and is also useful against other named demons and quest nemeses. When they teleport away, they teleport to the up staircase, and if you're on the up staircase, they don't teleport away from you. But when you meet them, you'll be much closer to the down staircase. Fortunately, if they're next to you when you go upstairs or downstairs, they will follow you.
So the thing to do is head for the down staircase, wait until Demogorgon's next to you, and head down. (Repeatedly healing yourself during this whole procedure, of course.) If you land on the up staircase, you're all set to fight him. If he lands there, fight him anyway until he either moves away and lets you in, or escapes upstairs (in which case you follow him and start it all again). Once you're on the up staircase, stay there until you've killed Demogorgon.
While fighting him, you need to keep switching between attacking him and healing yourself. The safest thing to do is heal yourself whenever you are ill and attack only when you're not - as long as you are very fast and unburdened, you will sometimes get two moves in a row, giving you a chance to attack. If you like living dangerously, get into a whack/heal cycle - heal yourself and take a swing at him on alternate moves - or even the whack/whack/heal cycle mentioned above in which you take two swings at him before healing. As discussed, you won't die from your illness when using this strategy provided that you have a reliable means of healing yourself. Remember to keep an eye on your hit points and be alert for any summoned nasties turning you to stone or slime.
Clearly, you want to kill Demogorgon as quickly as possible to minimise the chance of YASD. It may help to know that like all demons he is extra vulnerable to silver weapons, and that his only resistances are to fire and poison.
The best method of healing yourself is to cast the spell of cure sickness at 0% failure. For some classes (e.g. Wizards trying to kill Demogorgon with Magicbane) it is wise to be at least Skilled in healing spells, so that you can keep casting cure sickness when you're out of magical energy.
Any character can cure their sickness with a blessed +6 or +7 unicorn horn. This has a 10% failure rate, but it has the useful side effect of a 90% probability of fixing any stunning or confusion.
You can also cure yourself by drinking blessed potions of healing, non-cursed potions of extra or full healing, or holy water (non-chaotic characters only). Blessed potions of amnesia will also work (by making you forget your sickness), but this is probably a bad idea. Polymorphing into a new version of yourself will cure sickness; this is probably most useful for Doppelgangers, who can use the #youpoly command. Healers can use a medical kit (for other classes, the failure rate is at least 1/6). Eucalyptus leaves and holy wafers are other ways of curing sickness, but I wouldn't recommend them - they might be rotten, and you do not want to be unconscious with Demogorgon around.