It is amazing that you were not too lazy to spend time and type your question here, although if you had done the same action in Google you would have immediately received all the necessary answers.
Without going into details, this is a way to come to an agreement. Blockchain, as a rule, is a decentralized environment, and for its normal functioning,
it is necessary that all network participants are in consensus with each other. In other words, consensus is an algorithm a set of rules and functions that allow network participants to agree.
There is also the concept of a protocol, which is sometimes confused with consensus. The protocol is the initial rules of a particular blockchain, while consensus is the algorithm by which these rules work.
There are several types of consensus algorithms; all information about them has long been on the network. I will only mention the most basic ones that you have probably already heard about.
PoW (Proof of Work):
Example: Bitcoin.
The main feature is protection against
Sybil attack.
The main disadvantage is that for the operation and security of the network, it is necessary to perform calculations requiring large energy costs.
There is also the problem of centralizing the hash rate.
PoS (Proof of Stake):
Example: DASH, NEO.
The main feature is there is no need to have computing power, it is enough to have a certain number of coins on the balance.
The main disadvantage "Nothing at Stake" problem.
You can delve into the technical details of the above algorithms here.
https://bitfury.com/content/downloads/pos-vs-pow-1.0.2.pdf