We live in a society where individuals are mostly free to negotiate salary and compensation with whoever they choose to work for, and employers are in turn free to negotiate with who they want to employ.
The actual compensation then comes down to a mixture of supply, demand and negotiation skills. This can often lead to "unfair" outcomes - but we've found that alternative systems in which prices and wages are externally regulated result in everyone being worse off.
Why is this so? It is not so much to do with how hard people work, but how much risk-takers are compensated for taking on risk. If risk takers aren't adequately compensated (and for sure, part of what they are risking is the time they are spending), it becomes irrational for anyone to take on the risk, and so no-one does. Then, everyone is worse off.
To give a concrete (but arguably overly simplified) example: During the industrial revolution, there were lots of different attempts at making more efficient steam engines. It wasn't possible to know up front which designs were going to work and which weren't. But people were motivated to try lots of different things, because they knew that if they succeeded, all of the time and money spent researching each failed attempt would be more than paid for once they succeeded. Without that compensation though, it doesn't make sense to even try, leaving everyone with the inefficient steam engines.