How radiocarbon dating works
There are 3 kinds (isotopes) of carbon in the natural environment. Atoms of different isotopes differ only in how many neutrons are in the nucleus. Carbon-12 (written 12C) has 6 protons and 6 neutrons, for a total of 12 particles in its nucleus. Carbon-13 (13C) has one extra neutron, that is, 6 protons and 7 neutrons. Carbon-14 (14C) has two extra neutrons, that is, 6 protons and 8 neutrons. The three isotopes are chemically identical for most practical purposes. They all act essentially the same in all chemical processes, including the metabolism of living things. They differ only in the number of neutrons in the nucleus.
Most carbon is 12C. About 1% is 13C. About 1 part per million (1/10,000 of one percent) is 14C, which is radioactive. That is, the nucleus of a 14C atom is unstable, due to its excess neutrons. Sooner or later, any given 14C atom will "decay", in order to settle down to a more stable configuration. When a 14C atom decays, it converts into a 14N (nitrogen) atom.
(Detail for the physics-minded: This "decay" consists of the 14C atom emitting a beta particle [a high-energy electron] from the nucleus, which converts one of the neutrons into a proton, creating a nucleus with 7 protons and 7 neutrons: 14N).
14N is stable and is the major component of the earth's atmosphere, so when a 14C atom decays into nitrogen, it essentially gets lost in the crowd.
14C has a half life of 5730 years. That is, if you have 1 gram of 14C, in 5730 years, one half of it will have decayed to 14N. In another 5730 years, half of the remaining half will have decayed to 14N... and so on.
So why is there any 14C around any more? Shouldn't it all have decayed away?
It has... but new 14C is constantly produced in the upper atmosphere by cosmic radiation, mostly high-speed particles emitted by the sun. Through a series of steps, this cosmic ray bombardment converts occasional 14N atoms into 14C. The relatively constant rate of production of new 14C balances against the constant decay of existing 14C, resulting in a constant percentage of 14C in the atmosphere.
Plant and animal tissues contain a lot of carbon. Land plants get their carbon from the carbon dioxide in the atmosphere, and animals get their carbon from plants that they eat. So living terrestrial plants and animals are made of carbon that has recently come from the atmosphere, and has essentially the same fraction of 14C as the atmosphere. Since most living tissues are constantly being remodeled through growth, repair, absorption, etc., they continue to have the same fraction of 14C as the atmosphere as long as the plant or animal is alive.
When a plant or animal dies, the tissues stop being renewed through biological processes. The 14C in the dead tissues keeps decaying away, but it is no longer replenished by fresh 14C from the air or from food. This means that the 14C in the tissues begins to gradually decay away after death.
So, since you know what fraction of the carbon in the air is 14C, you know the fraction of 14C that the organic tissues started with. If you measure what fraction of the carbon in the dead tissues is 14C now, you can calculate how much 14C has decayed away. Since you know the rate of decay, you can then calculate how long it has been since the plant or animal died.
There are a few complications, of course. First, the amount of 14C in the atmosphere has not actually been exactly constant, probably due to variations in the "weather" on the surface of the sun, which affects the cosmic rays that produce 14C in our atmosphere. We know this because people have radiocarbon dated wood from individual tree rings of exactly known age (essentially by counting rings back from the outer surface of a living tree). But now that hundreds, if not thousands of such rings have been dated, we can correct for this slight variation. These corrected dates are called "calibrated" dates, written like "700 cal BC" or "cal AD 700", and they appear to correspond quite well to calendar years. Calibration makes the date older than the uncalibrated radiocarbon ages. The difference approaches 2000 years at 10,000 cal BC, around the end of the Pleistocene (Ice Age).
Another problem is that radiocarbon measures the time since a living thing died. Sometimes that is not what we are actually interested in dating. For example, say you collect some burned wood from an ancient campfire. You want to know when someone camped at the site. If you date the wood, the radiocarbon date will tell you when that branch or tree trunk died, not when the person made the campfire. The wood might have been laying around on the ground for a century or several before someone picked it up to use as fuel. If so, the radiocarbon date, even though perfectly correct, will mislead you into thinking that the campfire was made centuries before it actually was.
Radiocarbon dating has some limitations, too. It works on samples from about 1940 AD (just before the first atomic bomb test, which caused a huge spike in the 14C content of the earth's atmosphere) back to around 50,000 - 70,000 years ago. In samples older than that, too little 14C is left for an accurate measurement. That is plenty old enough for studies of complex societies, but it does not go back far enough to help us with the appearance of the earliest modern Homo sapiens, the Neanderthals, or anything earlier.
In addition, because the date depends on a measurement, and there is always some uncertainty about the exact value of any measurement, an estimated error range should be included with all dates. A typical error range is ± 60 years for a date of 2000 years ago. That figure means that there is a 68% chance that the true date falls within the indicated range. For a date of 100 AD ±60, there is a 68% chance that the date lies between 40 AD and 160 AD. That means there is still a 32% chance (about one chance in three!) that it falls outside the range. If we double the error estimate, there is a 95% chance that the date falls in the doubled range. That means we can be pretty sure (even though we will still be wrong 1 time out of 20), but doubling the error estimate usually gives a pretty broad, vague range for the date.
There are other dating methods based on clever physics tricks that work in certain circumstances, but radiocarbon dating is by far the most commonly used and trusted technique.