Mining is the process of adding bitcoin transactions to Bitcoin’s public ledger, otherwise known as its blockchain. Every 10 minutes, a group of bitcoin transactions from the mempool are aggregated and turned into a block by miners. Then, these miners from all over the world attempt guess the solution to the proof-of-work puzzle by successfully guessing a nonce. If they are successful, the miner will propagate the block to its peers and the block will be broadcast on the blockchain. If the mined block successfully makes the blockchain, the miner will receive the block reward.
Mining is a zero-sum game, meaning that only one miner can win the block reward every 10 minutes. Computers that mine bitcoin blocks must expend a lot of energy to do so, called “proof-of-work.” Proof-of-work is what allows Bitcoin’s blockchain to resist efforts to alter its history.
To ensure that a given bitcoin transaction makes it into the next block, you can add a mining fee to incentivize that miners choose choose your transaction as one of the transactions in their mined block.