Bitcoin mining is a process of adding new transaction records, or blocks, to a blockchain. Bitcoin miners achieve this by solving a complex mathematical puzzle called a proof of work.
The primary purpose of mining is to allow Bitcoin nodes to reach a secure, tamper-resistant consensus. Mining is also the mechanism used to introduce bitcoins into the system.
Miners are paid any transaction fees as well as a “subsidy” of newly created coins.
This both serves the purpose of disseminating new coins in a decentralized manner as well as motivating people to provide security for the system.
Bitcoin mining is so called because it resembles the mining of other commodities: it requires exertion and it slowly makes new units available at a rate that resembles the rate at which commodities like gold are mined from the ground.
To be confirmed, transactions must be packed in a block that fits very strict cryptographic rules that will be verified by the network. These rules prevent previous blocks from being modified because doing so would invalidate all following blocks.
Mining also creates the equivalent of a competitive lottery that prevents any individual from easily adding new blocks consecutively in the block chain. This way, no individuals can control what is included in the block chain or replace parts of the block chain to roll back their own spends.