Players can carry only a limited weight, and without a bag only a maximum of 52 items plus gold and a loadstone. Thus, most games will involve the creation of a stash - a safe repository of useful or useless objects.
Using containers Edit
A chest is heavier still, and also waterproof.
An ice box is the only container that gelatinous cubes will not engulf, destroying the container (but not its contents) immediately. Any item can be stored safely inside an ice box -- corpses will not rot, potions will not freeze, etc. Ice boxes are extremely rare, comprising 0.5% of all tools, and may need to be polypiled or wished for.
The heavier containers are more secure, but they are also less convenient if you decide to move your stash around.
Basic Security Edit
Placing your stash in a room with locked doors will prevent most monsters from ever finding it. Some monsters can unlock and open doors, and some can pass through locked doors, while others can dig down the walls.
Prior to 3.6.0, a stash could be protected by (E)ngraving Elbereth into the floor beneath it. To burn Elbereth, use a wand of fire (uses a charge) or a wand of lightning (uses a charge and normally causes temporary blindness). This will prevent monsters stepping on the square, keeping your stash items safe. Beware that some monsters don't respect Elbereth.
Elbereth can also be used on the entrances to the area around your stash - e.g just inside the door of the room. Elbereth requires an item to be present on the square to be effective. This is traditionally done by dropping a single Zorkmid on the engraving.
In 3.6.0, Elbereth only works when you're actually standing on the square, so is no longer useful for protecting stashes.
Alternatively, a dropped scroll of scare monster performs the same purpose, even in 3.6.0. The same monsters that don't respect Elbereth also don't respect this. Also you'll need to repeatedly bless or replace your scrolls when you move the stash around.
A cursed item on top of your stash will keep your pets from carrying the stash away.
Good stash location Edit
A good stash is located in a convenient place, that you can return to later to retrieve your items without having to traverse too many dungeon levels.
In the early game, before you can secure the stash properly (see below), the Minetown light shop might be a reasonable location. Even if a monster does dig down the walls, they are repaired quickly. Plus, you will be returning past this location on your way back up from Mine's End.
The Castle or the Valley of the Dead are popular stash levels, as they both generate immense amounts of loot and have abundant chests. The Valley also has a temple, but it is unaligned. Another popular stash is the first level of Sokoban as it can be branchported to directly with the Eye of the Aethiopica, spawns relatively weak monsters, and is close to the Dungeons of Doom and the Gnomish Mines where there are many shops and altars.
Some players prefer to keep their stashes on levels which can leave bones files, so that if the unthinkable happens, they stand a chance of seeing their loot again, albeit through the eyes of a different character.
A chest will suffice to protect your items from nearly all threats, but paranoid players have been known to go several steps further.
The easiest additional security measure is to place a boulder on top of your container. A chest with a blue jelly on it is incredibly secure, but inaccessible without killing or moving the jelly (a tame blue jelly might work very well).
An oilskin sack underwater is also perfectly secure, providing there are no water trolls on the level and you can get to dry land immediately after looting it.
You can store items in a pit, and push a boulder on top of them. This makes the items totally inaccessible, except for you and monsters which are trying to flee by digging a hole in the floor. You will need a new boulder each time you want to cover your items after digging them up for retrieval. Organic items underground will rot, and will need to be placed in a container. All containers except ice boxes are themselves organic, and will rot when underground.
Additional use of stashes Edit
This is sometimes useful next to an altar, to tidy away all the items that numerous sacrifices will generate. For long sessions of sacrificing at an altar, it can be useful to have one stash in which useful items are stored, and another into which junk can be cleared away.
You might want to secure your junk if you plan to retrieve it later; you might come back for that potion of sickness and scroll of punishment when you have cancellation, whether your plans involve making holy water or using a magic marker. Don't let some monster throw your own discarded potions at you!
The sortloot and menucolors patches can help you identify your stash. Both patches are installed on nethack.alt.org, thus many players do use them. When configured, the sortloot patch sorts the inventories of piles and containers, while the menucolors patch assigns colors to certain menu items. With these patches, you can list all your wands of fire together and flag as red all the cursed junk.