This question already has an answer here:
To my understanding, the execution of the code inside a smart contract is done by all nodes in the network. However the miners are the only ones who receive the paid gas. Also, when setting up the mining client, the miner (person) can specify the gas price (or cost?) range to accept the job of executing a smart contract.
I am confused. If the smart contract is to be executed on every node of the network, why some miners can refuse to accept the job, and why is it fair that only the miners are rewarded, given that everyone is involved in the computation?