When a transaction is being made, it is sent to a pool of awaiting transactions. Groups of these are then picked by miners all over the world and stored inside of a block. Each miner competes with all the others regarding who will publish their own block. When a block is published, the miner that published his block gets rewarded and he and all the other miners start working on the next, limited size block.
At a very high level, Bitcoin mining is a system in which all Bitcoin transactions are sent to Bitcoin miners. Miners select one megabyte worth of transactions, bundle them as an input into the SHA-256 function, and attempt to find a specific output the network accepts. The first miner to find this output and publish the block to the network receives a reward in the form of transaction fees and the creation of new Bitcoin.