Potions of gain level will increase your experience level. An uncursed potion will do only that. Quaffing a blessed potion of gain level will set your experience level to some point midway between your newly-increased level and the next level. Uncursed potions will not add experience points; if you have 39 experience points and are level 2, a blessed potion would put you at 60XP and level 3, while an uncursed potion would put you at the very beginning of level 3: 40XP.
A cursed potion does not increase your experience level, but does increase your dungeon level, one of NetHack's many puns. Quaffing it causes you to rise through the ceiling. Cursed potions of gain level are most useful for quickly leaving Moloch's Sanctum and other no-teleport levels while on the ascent to the Elemental Planes, and can be used as an escape item in a pinch. However, there are some places they do not work: the endgame levels, Sokoban, the top floors of the Wizard's tower and Vlad's tower, the top floor of the Quest, and Fort Ludios. Quaffing the potion in those places will only result in an "uneasy feeling."
Use by monsters Edit
An intelligent monster will quaff a potion of gain level if it finds one, or if it is generated with one in inventory. If the potion is noncursed the monster will gain experience, and possibly grow up into a more powerful version (eg. a master lich into an arch-lich). If it is cursed, the monster will rise through the ceiling where possible. (On a level where the cursed potion does not function, you will see that the monster "looks uneasy.")