A bit of history - The Bitcoin was invented by a man (or a group) using the pseudonym of Satoshi Nakamoto and having stayed anonymous. Satoshi Nakamoto launched the first version of Bitcoin in 2008 and gradually let out to other developers contributing to the project Gavin Andresen and others. No one has had any contact with Satoshi Nakamoto since mid-2010.
Prerequisites for understanding - The Bitcoin protocol is mainly based on technologies available and used before his appearance including:
Asymmetric Cryptography: a very popular cryptographic technology that allows notably to identify the author of a message: Each user has a public key and a private key. He uses his private key (known only to him) to encrypt a message that can be decrypted using his public key so he can be identified as the author of the message.
Cryptographic Hash: Function that creates a short fingerprint of a message or file, unique and non-reversible. Bitcoin mining consists in finding a particular result produced by this function to ensure that the minor has a certain computing power. Example: SHA-256 cryptographic hash of the text "Satoshi Nakamoto" is a0dc65ffca799873...5425f7337704883e but it is impossible to reverse it to find the original text without trying all possible combinations.
Bitcoin is a form of virtual currency, its has no representation in the real world as some currencies were represented by gold stocks (As the dollar before 1971). Its value is determined only by the market that gives it a value to make it a medium of exchange. Thus the Bitcoin is similar to gold: in fact, except for a few cases (Electronic, esthetic ...) the value of gold is assigned by the market to make it a medium of exchange, chosen for its properties: rarity, durability and divisibility, properties in common with Bitcoin.
Bitcoin can not be created by an entity or state and is limited to 21 million units called bitcoins (No capital B - the writing with a capital B refers to the technology). The number of bitcoins in circulation increases in a stable and predictable way to reach the final total of 21 million in 2140 (The slowdown of the "production" will be such that 99% of these 21 million will be available in 2030 while the remaining 1% will be put in circulation between 2030 and 2140 - see Controlled supply on Bitcoin Wiki). Each bitcoin is divisible into 100 million units called Satoshis. This makes a total of 21 x 1014 of indivisible units. Why this number? Maybe because it is close to the limit of the storage capacity of a 64 bit number, used very commonly in IT, but we do not have much more on this choice which matters little because of the divisibility of Bitcoin.
We will explain how Bitcoin works step by step by presenting the problem behind the idea of a decentralized currency and the solutions brought by the Bitcoin. This explanation is a simple approach of the mechanisms behind Bitcoin and does not constitute a complete or rigorous explanation.
Issue – With a decentralized currency, how to safely identify the person sending money?
The protocol uses the asymmetric cryptography system. Bob wants to send 1 bitcoin to Alice so he uses his private key to sign the message "I, Bob sends 1 bitcoin to Alice" then using his public key, anyone can verify that it is Bob that sent this message and he can't claim otherwise.
Issue – How to prevent Bob from duplicating this message and sending an unlimited number of times that bitcoin?
We give this bitcoin a serial number, eg 42001. The message will be now "I, Bob is sending 1 bitcoin No. 42001 to Alice." Therefore this bitcoin is clearly identified and this message can not be duplicated. (Actually, a bitcoin does not have a serial number but is traceable from its generation until this last use, which makes it to uniquely identifiable.)
Issue – How to verify that Bob does indeed have this bitcoin No. 42001 and didn't spent it already?
Each user has a "ledger" called the blockchain which lists all the transactions and therefore who owns which bitcoin. Bob is sending the message "Me Bob is sending 1 bitcoin No. 42001 to Alice" but this time Alice uses her copy of the blockchain to verify that this number belongs to Bob . Then she sends to everyone Bob's message and a message indicating to everyone that she accepts this bitcoin and everyone updates their blockchain.
Issue – How to be sure that Bob does not send the same message simultaneously to two people who do not have time to update their the blockchain and therefore do not know the bitcoin No. 42001 has already been sent ?
This is where the bitcoin miners come in. Alice thus verifies that Bob has the bitcoin No. 42001 but before accepting it, she broadcasts her message to network's miners who in their turn check that the transaction is valid and spread the message "Ok, Bob has the bitcoin No. 42001, it can be sent to Alice" Once this message is broadcast by enough miners, everyone updates their blockchain, the transaction is made.
Issue – If Thomas is a bitcoin miner, how to prevent it from spreading thousands of times the messages "Ok, Bob has the bitcoin No. 42001, it can be sent to Alice" and "Ok, Bob has the bitcoin No. 42001, it can be sent to Carol "and thus manipulate the network?
To handle this network manipulation problem the Bitcoin uses the system of "Proof-of-work". The operation of spreading the message "Ok, Bob has the bitcoin No. 42001, it can be sent to Alice" is made artificially difficult for a miner by making him do complex but useless calculations before spreading the message : a succession of cryptographic hash to find a particular value.
As a result if Thomas wants his false messages to be accepted he must have more than 50% on the network power. Our page Cost of a 51% attack is an estimate of what would cost a minor to be in such a situation based the number of miners. The gain of such an attack is ridiculous face to the cost.
Issue – What motivates miners to verify transactions?
Minors are rewarded with new bitcoins that are created at a steady, predictable rate that will reach a final total of 21 million in 2140. After that date, the miners will only be rewarded with low commissions earned on every transaction validated.
To go in more detail, you can read the paper published by Satoshi Nakamoto: Bitcoin: A Peer-to-Peer Electronic Cash System.