A post by Amir Taaki (genjix) on Bitcoin Media (@BitcoinMedia) describes how and why bitcoin mining performs “work”. Excerpts:
Another property of a good hash function is small changes in input lead to large changes in output. This makes it difficult (practically impossible) to reverse a hash function.
A bitcoin miner is constantly hashing a block to see if it passes the above check. If not then it slightly modifies the block and tries again. It keeps doing this until it finds a block that passes. A valid block has been found, and the miner will broadcast this block to the network.
A miner’s task is to make a block and keep modifying that block so that it produces a different hash, until that hash passes a [specific] test.
Creating a block is not easy. It takes computational processor cycles. Ergo it takes electricity. Ergo it costs money. Creating a block usually has miniscule profit or even negative expected value. As more people mine and create blocks, the network drives up the difficulty squeezing out all the profit.