How it works
The network sets a difficulty target, and miners race to find a number that hashes the next block header below that target. The first to solve broadcasts the block. Other nodes verify the solution in milliseconds, then accept it as canonical. The successful miner receives the block reward (newly issued coin) plus all transaction fees in that block.
Example
Bitcoin miners use ASIC machines that perform tens of trillions of hashes per second. A single modern ASIC at 100 terahash per second draws about 3,000 watts, costs $5,000, and earns roughly $7 per day at current network difficulty and BTC price. Profitability is dominated by electricity cost; below $0.05 per kilowatt-hour the unit is profitable, above $0.10 it usually is not.
Why it matters
Mining is the security mechanism behind Bitcoin and a few other proof-of-work chains. The cost of attacking the network equals the cost of accumulating more mining power than all honest miners combined, which is currently in the billions of dollars per day for Bitcoin. Proof-of-stake networks (Ethereum, Solana) replaced this with staked capital. Both are economic security models, just with different cost structures.