I recently purchased a set of three shelves of different sizes. I attached them to the wall with the provided hardware (screws and plastic sleeve anchors) and they stay up fine by themselves, but when I put things on them they come crashing down. I've weighed the items and they're barely half the supposed weight limit of the shelves, so I don't really know what's happening. How do I make them stay?
TL;DR Toss the anchors, find the studs and use them
What you described sounds like typical drywall anchors. While the anchors themselves, even the cheap ones, are usually strong enough, they are highly dependent on the wall being in excellent condition (e.g., if you put an anchor in an area that was patched, it won't hold up very well), correctly sized, not reused, etc. But they generally don't work all that well for heavy stuff like shelves, especially with books or 1980s computer tape backup drives.*
Sometimes you can move to an upgraded anchor or a toggle bolt and do better. But the gold standard is to use long screws into studs. Installed properly, screws into studs can support shelves with heavy stuff and even entire cabinets full of dishes. Studs are usually evenly spaced (16" or 24"), but there are exceptions. There are also times you find somewhat thinner wood turned sideways - enough to support drywall and probably enough to support a lot of shelves and things, but requiring screws sized just right (and shallow electrical boxes, as I discovered the hard way). There are also times where you find that your walls have masonry behind the drywall, which can absolutely support shelves but requires entirely different hardware.
* In the summer of 1985 (+/- 1 year - I was there for 3 years and not sure when this happened) I interned at a large organization which mostly used mainframes but had started to use PCs. They had a room of IBM PC XTs and decided to get backup tape drives. The tape drives were big heavy boxes, each about 1/2 the size of the computer it was connected to. The computer tables really didn't have enough space for everything, so the building maintenance guy came in one day and installed a nice shelf over each computer. Then we put the tape drives on the shelves. And the shelves started pulling out of the wall. And the maintenance guy came back to mount the shelves into the studs. No hernias. No broken computers - but came close to that.