Suppose someone send a transaction, `set(10);`

Generally speaking, each miner will run the function to assess the result and possibility 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 agreement about their *independent conclusions* about the result of the transaction. 

Hope it helps.