There are a number of online calculators related to the problem in the answers & comments to an earlier question about building shelves:
- What are cheap ways to build strong shelves with a large span?What are cheap ways to build strong shelves with a large span?
References included:
- The Sagulator (sag calculator for different types of wood & related materials)
- Elastic Beam Deflection Calculator (can handle lots of different loadings, but you have to know the properties of the materials)
- Structural Beam Deflection and Stress Formula and Calculation (gives formulas, but doesn't have the fancy javascript calculators)
All of these were to calculate sag -- wood and metals are going to sag before they collapse in most cases. The exception would be when fasteners tear out the side of wood (eg, an anchor comes free from the wall), and sometimes, there isn't a whole lot of time between sag & fail (I had a bookshelf bow, pull free from the shelf supports, and then cascade as it took out all of the other shelves below it).
Concrete will fail explosively (sudden collapse with little to no warning, which is why reinforced concrete specifically has less than the optimal amount of steel in it, so the steel goes first), but that's not normally used for shelves.