Those are quite some widespread questions.
Tracking of account balances
There are two parts that keep track of an accounts balance:
- each node keeps track of the transaction history
- a node keeps track of the private keys for the accounts it owns
Bitcoin at its core is a distributed ledger that keeps track of every transaction ever executed. Every node in the network stores a copy of the complete transaction history and can therefore reconstruct the balance for each account. Catching up with the rest of the network will take quite some time exactly because you need to download and verify the whole transaction history.
The private keys come into play when bitcoins are transferred from one account to another. To spend bitcoins you have to create a transaction and the owner of the sending account has to authorize the transaction by signing it with the private key associated with the account. So anybody that knows the private key to an account may spend the bitcoins that are in that account. Bitcoin-QT (the client you downloaded) creates a file on the harddisk called wallet.dat
, which contains all the private keys for your accounts, so don't lose it. Other clients use different methods of storing the private keys.
Mining (or "free" bitcoins)
Mining is Bitcoin's way of minting new currency. There is no central bank that prints bitcoins, instead nodes are rewarded for their help in the network. They help the network by verifying and confirming the validity of transactions in the network.
As others have pointed out mining is not free: the initial investment in mining equipment has to be amortized and electricity has to be paid. While initially it was easy to mine, the fact that you compete with all the other miners about a limited supply of new bitcoins mined has quickly driven the cost of mining up.
Mining nowadays requires such a high investment that some miners never break even.