You can see this at work in NYC right now: the relative ease at acquiring financing means there are a lot of really dumb startups here right now with stupid ideas and no real market that are tying up valuable engineering talent which makes recruiting harder for legitimate startups that are genuinely creating value. Imagine if all the engineers who worked at Google during the early days were instead tied up working for Pets.com and Webvan such that Google was never really able to get off the ground and folded. That would have been bad for everyone, because Google ended up creating a lot of real value and Pets.com did not.
This same reasoning, I think, applies to the question of why CEOs get paid such astronomical salaries. The answer is that the kind of people with the skills to run a large company are extremely few and far between. Sure, a lot of them do fail at their jobs despite getting paid so much money; but that's not a reason for a hew and cry about how much they’re paid—it’s (usually) simply a testament to how hard the job actually is to pull of successfully. (Incidentally, it’s a common lament that the people at the top get paid disproportionately more than everyone else. But that’s just because the scale doesn't increase linearly—it grows exponentially. I'm not sure what the outrage against such a fact is—if you’ve taken differential equations you’ll remember that myriad complex mechanical, electronic, chemical, astronomical, biological, economic, etc. systems have nonlinear characteristics.)
So the idea is that salaries for scarcer resources are generally higher such that only enterprises creating sufficient value (i.e., profits, or at least a general confidence in future profits) to pay for them are the ones who get them. It’s certainly arguable whether this is what occurs in practice; and—while there are always exceptions, transients, and outliers—I think by and large it’s a good approximation.
This is kind of tangential to @jacquesm’s point, I know, because he’s simply pointing out that we should be cognizant that we get paid more for arguably easier work—but all the same I think it’s important to keep in mind that making things more ostensibly ‘fair’ may not always be in everyone’s best interests in a larger sense.