Suppose someone sendsends a transaction, set(10);
Generally speaking, each miner will run the function to assess the result and possibilitypossibly include it in a block.
After it's mined, each full node will run the function to assess the result.
At the end of this process, the nodes will be in agreement about their independent conclusions about the result of the transaction.
Hope it helps.