The database that keeps track of which addresses have how many bitcoins is stored in the form of a “block chain”, which is extended by one block roughly once every ten minutes. Each block contains all of the transactions that have taken place during that time, and when a block is added to the chain, it signifies a consensus among the Bitcoin network that those transactions took place at that time. As time goes on and more blocks are added on top of that block, the consensus solidifies, and after four to six blocks, any attempt to fraudulently change the transaction history to your own benefit becomes impractical because of all the work that has already been done overtop. Blocks can be created by any node on the Bitcoin network, and to regulate the rate of block creation, the network imposes constraints on the form that a valid block can take, with the result that it requires a lot of trial-and-error work to find a block that is valid – so much work that the entire network only manages to find one roughly once every ten minutes. That is a constant; there is an adjustable parameter called the “difficulty” which the network collectively manages to make sure that the actual block creation rate never strays far from that value.
Because creating (or “mining”) blocks is so crucial to the security of the Bitcoin network and yet so hard, the Bitcoin protocol includes a mechanism to encourage people to mine: every time a block is added, the miner who found the block is given 50 BTC as a reward. There is also another mechanism to encourage mining called transaction fees, which will grow in importance in the far future, but for now, the block reward is by far the largest financial incentive to encourage people to participate in the block creation process. The block reward also has another function; it the only way that new bitcoins come into existence. Any bitcoin that you send or receive was at one point somebody’s block reward.