I’ve said before that I prefer to place a magic item instead of money. Because I don’t like magic shops, opportunities to buy magic items are limited, so players can always choose to trade out a magic item for money but can’t really do the reverse to get whatever item they want (typically they’ll have a couple purchase options every game session but not necessarily the exact item they were hoping for).
But how to place those items? I go about it in several passes.
Layer 1: Total value. I want enough value worth of magic items so the players get enough treasure to level up. This is more important in games where you get XP for GP. In the game I’m running, for example, you get 1 XP per GP, and 1 XP per GP value of magic items you decide to sell without using, but generally about 10% of the XP value for the magic item if you decide to keep it. If the players sell the magic items they get more XP and are higher level, but if they keep them all they are lower level but more powerful because they have the items. It tends to work out regardless of what they choose.
Layer 2: Theme. If they’re exploring a dwarven temple, I want some appropriate magic items. If a monster hoards items the loot can be anything someone might have carried into its lair or that it found nearby. I like each treasure cache to be a little story. One time I had a secret room that connected two hallways, and far in the past some annoyed adventurer had hurled his pile of cursed items in there.
Layer 3: Usefulness. I don’t want a cache to be just a bunch of Fighter items because everyone else at the table is bummed. Items anyone can use are cool. At the same time, I want a balance of usefulness. Not everything has to be combat-related. Especially at low level an item that weighs nothing but replaces a bulky piece of equipment can be worthwhile (like a magical dome that works as well as a 10-man pavilion). This frequently runs counter to Layer 2 because at that point I might have a wizard tower and think that it needs a lot of wizard items in it. But maybe the wizard has a bodyguard, or a magical trap has a thief imprisoned and starved to death, he has some unidentified items, or he just has some goodies he can’t use and might trade away.
It’s tough to predict, like trying to make a viral video, but it’s great when a player really latches onto the idea of a magic item and it begins to make the character really stand out. Imagine if Thor’s player finds a kickass magic hammer at level 2, it becomes a thing with him, and he goes for the whole fur coat and horned helmet ensemble. Later he gloms on additional magic items like gauntlets, belt, and a better hammer. If not for the fortuitous attachment the player had to that first magic hammer, Thor might become just another Fighter. This can happen through the magic of a player being really in the groove and pleased to find a +1 thing behind a secret panel. It can also happen because the magic item isn’t just a bonus and instead gives him a different option to choose from.
Layer 4: Interactions with the other adventure elements. At this point it’s usually just a switch from one item to another so the players can use it in specific areas. Magic items as problem-solving tools. Sometimes I’ll start the process with Layer 4, with an item and a problem that it can solve, and then build the theme (Layer 2) and adventure difficulty (Layer 1) around that. Maybe it means I shelf this adventure idea for later. But when I come around at the end to do Layer 4 it’s typically stuff like “change the Potion of Heroism to Plant Control instead so they can part the razorvine if they found the potion and they think of it”.
You can do just fine without going through all this trouble. You really can say it’s a 5th level dungeon so you should put in a few +1 items, a few scrolls and potions, a +2 item, and a low-end ring or low-charge wand. I think in the published classic modules that’s what you see. But you also sometimes see a strange connection that shows some extra effort has been made to put extra depth in the treasure placement. It’s like the difference between one layer of glaze on a pot and multiple transparent layers of glaze: both pots hold the water.