Proof of Work(PoW) is the original consensus algorithm in a blockchain network. The algorithm is used to confirm the transaction and creates a new block to the chain. In this algorithm, minors (a group of people) compete against each other to complete the transaction on the network. The process of competing against each other is called mining. As soon as miners successfully created a valid block, he gets rewarded. The most famous application of Proof of Work(PoW) is Bitcoin.
Producing proof of work can be a random process with low probability. In this, a lot of trial and error is required before a valid proof of work is generated. The main working principle of proof of work is a mathematical puzzle which can easily prove the solution. Proof of work can be implemented in a blockchain by the Hashcash proof of work system.
In the below image, you can see that this block is composed of a block number, data field, cryptographic hash associated with it and a nonce. The nonce is responsible for making the block valid.
In the puzzle game, bitcoin software creates a challenge, and there is a game begins. This game involves all miners competing against each other to solve the challenges, and this challenge will take approximately 10 minutes to be completed. Every single miner starts trying to find the solution to that one Nonce that will satisfy the hash for the block. At some specific point, one of those miners in the global community with higher speed and great hardware specs will solve the cryptography challenge and be the winner of the game. Now, the rest of the community will start verifying that block which is mined by the winner. If the nonce is correct, it will end up with the new block that will be added to the blockchain. The concept of generating a block provides a clear explanation of proof of work(PoW).