Miners compete for the right to mine the next block by solving a cryptographic puzzle. Since the puzzle is a hashing algorithm, every time the function runs it is equally likely to solve it. This means that the percentage of the network’s hashing power held by each miner represents their ability to probabilistically mine the next block. A 51% attack refers to what happens when a malicious actor has control of 51% + of the network. They can mine consecutive blocks, change history and double spend coins.