Any blockchain changes its state via transactions.
Ambiguous transactions are inevitable.
E.g. Mike has only one bitcoin and tries to transfer one bitcoin to John, and one bitcoin to Mary.
Who will receive the bitcoin, John or Mary?
The nodes make a decision to execute or to reject the transaction.
And after the transaction execution all blockchain nodes will get to the same state.
The nodes use a special algorithm to accept and execute the transaction, it is the consensus mechanism.
Bitcoin was the first implementation of Blockchain technology. PoW (Proof of Work) consensus was used in Bitcoin.
The nodes (“miners”) form the blocks of transactions and then perform intensive calculations over the blocks to achieve some result.
When one node achieves the result, the transactions of the block are considered accepted.
After that all other nodes synchronize its state (synchronize the block) and form new blocks and look for a new decision – which transactions to accept.
The PoW is relatively simple , robust and well tested. But PoW consumes a lot of electric energy, so largest miners consolidate and this consolidation threatens to the idea of decentralization.