Players can carry only a limited weight, and without a container 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 objects.
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.
Since monsters cannot access the contents of a container, securing your stash really only involves three things:
1. Storing your items in a container instead of on the floor.
2. Using some method of preventing monsters from picking up the container itself.
3. Keeping it safe from Gelatinous Cubes.
The most direct way of preventing monsters from picking up your stash container is to simply make sure it is too heavy to carry. Dragons have the greatest carrying capacity of any monster, and can carry 3103 weight units. Therefore, placing 311 or more rocks into a stash container will ensure that no monster in the game can pick it up.
Placing your stash in a room with locked doors will prevent most monsters from ever finding it. Some monsters can get through doors though, or dig through walls. And monsters can always spawn inside the room when you're elsewhere on the level.
Prior to 3.6.0, a stash could be protected by writing Elbereth into the floor beneath it. This prevented most monsters from stepping on the square, keeping your stash safe. Some monsters don't respect Elbereth. Elbereth could 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 - placing a single Zorkmid on the engraving is traditional.
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. 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 boulder can also be placed on top of your stash. This works even if your items are not in a container, and it does not seem to break any items (I tried pushing a boulder onto an unprotected potion ten times with no breakage.)
A cursed item on the same square as your stash (not inside the container!) will keep sufficiently strong pets from carrying the stash away.
Good stash location
A stash of useful items or spares is best located in a convenient place, that you can return to later to retrieve your items without having to traverse too many difficult dungeon levels.
In the early game, before you can perform basic stash security, 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 both 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.
Some players prefer a greater degree of organisation during long games, and so use several stashes, or even separate stashes for each object type (potions, rings, wands, etc.)
Basic security protects your items from nearly all threats, but paranoid players can go several steps further.
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 apart from ice boxes are themselves organic, and will rot when underground.
Additional use of stashes
Stash of Junk
If your stash contains only junk, then perhaps it does not need security. That pile of cursed weapons and armor would not help those monsters much anyway. Such a stash might be useful next to an altar, to dispose of the items dropped by numerous monsters killed for sacrifices.
Some junk, such as discarded weapons, may still need some basic security, to prevent monsters using the items against you.
The sortloot patch sorts the items in listings (of inventory, piles or containers), so that duplicate or similar items appear next to each other. So you can immediately see that you're carrying three tin whistles, rather than missing some because they are listed scattered throughout your tools.
The menucolors patch help you visually distinguish items in listings, by assigning colors to certain menu items. For example it can be configured to use red text for cursed items, or items with names containing 'cur'. menucolors is built-in to 3.6.0.
Both patches are installed on nethack.alt.org, thus many players do use them.