This prized NetHack item is your inventory savior. Not only will it allow you to carry more than 52 items (A-Z, a-z), but it reduces the weight of anything placed inside it by 75%. You usually want to find one as soon as possible, because not having one is a huge pain. I recommend storing all the items you have to drop (due to lack of inventory space) in a box or chest until you acquire your bag of holding; then you can go back for them.

Scientifically speaking, a bag of holding works by trapping an extradimensional space (usually on the Ethereal Plane) that opens into the neck of the bag. Hence, the bag is much bigger on the inside than it is on the outside. A bag of holding can hold as many items as you want. Since the items are actually on the Ethereal Plane rather than in the bag, only a fraction of their substance remains on the Prime Material Plane -- hence the weight reduction.

After completing the Sokoban level of NetHack, you will either find a bag of holding or an amulet of reflection for your troubles.

Never, ever put a wand of cancellation inside a bag of holding. You have been warned.