Mining is basically a record-keeping service with several simultaneous users called 'forks,' in bitcoin's case. Forks happen when two blocks containing valid transactions appear at the same time. The fork that gets accepted into the chain becomes part of the permanent database in that everyone can see it in plain text forevermore, while the other fork gets ignored by everyone on the network for being an orphan block. Miners get rewarded for keeping things running smoothly & verifying blocks of transactions.