Consensus algorithms are the mechanism used to reconcile security and decentralization in a blockchain.
In consensus via Proof-of-Work (mining), the purpose is to secure the chain while controlling the system across as many participants as possible. The reward of newly minted currency is an incentive to those who contribute to the security of the system.
In consensus via Proof-of-Stake (PoS), the blockchain tracks a set of validators (open to anyone who holds the base cryptocurrency, by locking up it into a deposit). Validators take turns proposing and voting on the next valid block, and the weight of each validator's vote depends on the size of their deposit (i.e., stake).