A distributed ledger has no central record keeper, so participants must agree on which sequence of transactions is the real one. Consensus mechanisms are the rules that settle that question.
The difficulty is disagreement, not recording
Copying a list of transactions to many computers is trivial. The hard problem is deciding what happens when two participants propose different next entries at the same time.
Without a resolution rule, the network splits into incompatible histories, and a coin could be spent separately on each branch.
Consensus exists to produce a single agreed ordering that every honest participant converges on, without any of them trusting the others.
Proof of work prices participation in energy
One approach requires participants to find a value that produces a hash below a target. Finding it takes enormous computation; verifying it takes almost none.
The right to propose the next block goes to whoever solves the puzzle first, so influence over the ledger is proportional to computing power expended.
Rewriting history means redoing that work faster than the rest of the network produces new blocks, which is the source of the security guarantee.
Proof of stake prices it in capital
An alternative selects proposers according to how much of the network's own asset they have locked as a deposit.
Behaving dishonestly results in part of that deposit being destroyed, so attacking the ledger costs the attacker directly rather than costing electricity.
The security argument is structurally similar: misbehaviour is made expensive. The resource being consumed is capital at risk instead of energy.
Finality is probabilistic in some designs
Under work-based consensus, a block is never formally final. Confidence grows as further blocks are built on top, since reversing it becomes progressively more expensive.
This is why exchanges wait for a number of confirmations before crediting a deposit, with the threshold reflecting the value at stake.
Some stake-based designs add explicit finality, after which reversal would require destroying a large share of the deposited capital and is treated as settled.
The trade-offs are structural rather than solvable
Increasing throughput generally means fewer participants able to validate independently, which concentrates the network and weakens the property that made it decentralised.
Designs therefore choose a position among decentralisation, throughput and settlement speed rather than achieving all three.
Most disagreement between competing networks is a disagreement about which of those properties matters most, not about whether the mechanisms work.