Choosing an air compressor involves several factors, mainly CFM and tank size.
If you had a 1 CFM compressor and a 100 gallon tank, you could run just about any tool for a long time. The compressor would run all the time, and store air in the tank when you're not using the tool. If you had a 20 CFM compressor and a 1 gallon tank, again it would run just about any tool continuously. But it would cycle on and off a lot, and wouldn't last very long. Somewhere in the middle is the best way to go.
A framing nailer will use about 2 CFM or less while framing walls. While shooting decking, subfloor, or sheeting, it'll use more like 10 CFM. A small hand-held sandblaster will need about 10-15 CFM. A car body sander uses about 15-20.
Most air tools are rated for a 15 second run time. This means if the usage is listed at 4 CFM, that's what it'll use if operated for 15 seconds each minute. An impact wrench is a good example of this. If you run the tool continuously (like the car body sander), the 4 CFM tool becomes a 16 CFM tool.
Be careful when choosing an air compressor. There's a huge amount of mis-leading advertising. Just because it says 6 HP doesn't mean it'll produce 20 CFMs. The 6 HP rating is the maximum the motor can produce, not what it actually runs at. As a basic rule-of-thumb, at 120 PSI a single-stage compressor will produce about 3-1/2 CFM per HP. A two stage unit will produce about 4 CFM per HP. To determine HP, don't go by what's advertised. Use motor current instead. Basically, a 2 HP motor will use about 10-12 amps at 230 volts. A 3 HP is about 13-16. 5 HP is about 20-24.
Generally speaking, you'll want the largest tank you can put up with. For a stationary unit, 30 gallon would be about the minimum. More is better. A portable unit will be smaller. The larger the tank, the more reserve you have, and the less CFM you'll need. The smaller the tank, the quicker you'll run out of air during heavy usage.
Like just about everything else, there is no perfect solution, what you should get depends on how you plan to use it.
Rob