The consensus algorithm decides who has the right to publish the next block in the blockchain (who becomes the "leader"). For traditional public blockchains (such as Bitcoin), the consensus algorithm is Proof of Work (PoW). That is, the node that solves a cryptographic puzzle first (generates a SHA-256 hash with the most leading 0s) wins the right to publish the next block. Unfortunately PoW is extremely wasteful of energy and active research is involved in developing new consensus algorithms.
Give yourself time to explore this field properly. Enroll in Blockchain Online Training now.