A fixing has three parts and they have to agree with each other: the hole, the plug and the screw. Get one of them wrong and the other two cannot compensate, which is why a shelf falls off a wall that would have carried five times the load. Working out what the wall is made of takes ten seconds and is the step that gets skipped, so the entry on wall plugs starts by reading the dust that comes out of the first hole.
In timber the questions are different but the discipline is the same. Gauge decides how much load a screw carries across its shank; length decides how much it carries along it; and the pilot hole decides whether the board splits. Those numbers are set out in the entry on gauge and length, with a table of the fixings a house actually asks for. Load figures quoted here are working figures rather than laboratory ones, and the difference between the two is roughly a factor of three, which is worth remembering every time a bracket goes up. Where the same screw is holding a repair while glue sets, the choice is covered in the finishes and glue section.