Natural 20s and Critical Hits
Critical Hits are truly spectacular, well-aimed blows that inflict many times more damage than normal attacks. When characters make an Attack Roll (d20 + Attack Bonuses), if they roll sufficiently high they may threaten to score a critical hit. The actual numbers needed to threaten a Critical Hit vary by character (certain weapon enchantments and feats may increase this range) and by weapon type, and this range of numbers is known as the Critical Threat Range. Regardless, any natural roll of 20 (on a d20) made during an Attack Roll will automatically hit, regardless of the Attack Bonus or Armor Class of the characters involved.
Critical Threat Range
The Critical Threat Range of a weapon are the numbers which - if naturally rolled on a d20 - will threaten a Critical Hit. Most weapons have a natural Critical Threat Range of 20 (meaning the character must roll a natural 20 to threaten a Critical Hit), but many (typically bladed weapons) have a Critical Threat Range of 19-20 (meaning a natural roll of 19 or 20 threatens a Critical Hit) and a few have a Critical Threat Range of 18-20. In addition to this, weapon enchantments like "Keen" or the feat "Improved Critical" will double the natural Critical Threat Range of a weapon. A longsword has a natural Critical Threat Range of 19-20, but a keen longsword (or a longsword in the hands of a character with the Improved Critical: Longswords feat) has a Critical Threat Range of 17-20.
Note: The effects of multiplier Critical Threat Range expanding feats/enchantments do not stack. Only one applies.
Note: Regardless of what your Critical Threat Range is, only a natural roll of 20 on a d20 is guaranteed to hit.
Critical Hit Confirmation
Assuming you've rolled a high enough natural number on your Attack Roll to threaten a Critical Hit, the next step is to confirm that Critical Hit. This roll - a Critical Hit Confirmation roll - is done by making a second roll which, in most cases, is identical to an Attack Roll. If this second Attack Roll is high enough to score a hit on the target (your Attack Roll meets or exceeds the target's Armor Class), the Critical Hit is confirmed.
For example, assume a character armed with a dagger (Threat Range 19-20) rolled a natural 19 on their Attack Roll, and the resulting total was high enough to meet or exceed the target's Armor Class; that attack threatens a critical hit. They roll a second Critical Hit Confirmation roll (which is identical to the first Attack Roll they made) and if that second attack roll is sufficient to hit the target, they score a Critical Hit instead of a normal hit. If the second attack roll is not high enough to otherwise count as a hit, they do not score a Critical Hit - they deal normal damage, instead.
You know how Critical Hits are determined, all that's left is to discuss damage. Most Critical Hits deal double the damage of a normal hit, and this is determined almost entirely by what weapon the character is using. Most weapons have a x2 multiplier (deals double damage on a critical hit), but some weapons have a x3 or even x4 multiplier. This Critical Multiplier, along with a weapon's Critical Threat Range, is usually listed as 20/x2, 20/x3 19-20/x2, 18-20/x2 (Critical Threat Range/Critical Multiplier).
Most damage is multiplied during a Critical Hit, but there are some exceptions. Bonus damage from Sneak Attacks are not multiplied, neither is damage caused by a weapon's enchantments. For example, an acidic weapon that deals 1d6 acid damage would not deal more acid damage on a critical hit unless otherwise stated in the item's description.
Spells and Critical Hits
Spells can not normally result in Critical Hits, which the exception of spells that require a Touch Attack or Ranged Touch Attack roll. Fireball might be fun, but it'll never score a Critical Hit, meanwhile spells like Acid Splash, Ray of Frost, Ray of Enfeeblement and Disintegrate can. The Critical Threat Range and Critical Multipliers of spells are assumed to be 20/x2 unless stated otherwise in a spell's description. Critical Hits with spells resolve identically to normal Critical Hits, including the natural 20 rule and the Critical Hit Confirmation roll. If a spell deals Ability Damage, that Ability Damage will be doubled, as will (obviously) normal damage dealt by a spell.
Keep in mind, however, that creatures still get their Saving Throws against such spells, although Critical Damage is applied before the save. For example, say a character lands a Critical Hit with Disintegrate, which normally deals 2d6 damage per Caster Level. Assuming the caster is a Wizard with the minimum Caster Level possible (as a 6th-level arcane spell, it would require an 11th-level Wizard to cast, hence at minimum a Caster Level of eleven), the spell normally deals 22d6 damage... now boosted by the Critical Hit to a whopping 44d6. The target, although critically hit, is still entitled to a Fortitude Save to reduce the damage dealt by half.