In simple terms, a consensus mechanism is a rule or algorithm used by blockchain network participants to reach an agreement on the state of the distributed ledger.
Each participant in a blockchain network keeps a copy of all transactions that occur on the network. For a newly added transaction to be accepted, all nodes must agree that the transaction is valid and authorized.
With the consensus mechanism, there is no one centralized party that controls the network. Instead, decisions are made jointly by many nodes distributed around the world. This maintains decentralization, which is one of the key principles of blockchain.