A 51% attack occurs when an attacker (or group) controls more than half of the network. 51% attacks are also referred to as majority attacks. With Bitcoin and other proof-of-work currencies, controlling the network means controlling the hash rate or computing power.
Consensus algorithms are paramount to the blockchain: cryptocurrency transactions need to be verified by a decentralised, trustless network of nodes. Consensus means that the nodes on the network agree on the same state of the blockchain.