When you score a critical hit, the attack's total damage against the target after adding ability modifiers, magical damage modifiers, or extra damage dice is doubled.
For example, imagine that a Level 3 Rogue with DEX+3 attempts a sneak attack and scores a critical hit with a Dagger+1. You roll the damage normally: 1d4+1 (dagger) +3 (DEX modifier) +2d6 (Sneak Attack) and receive a 3 on the d4 and a 6 and 4 on the d6's respectively. This yields 3+1 +3 +6+4 = 17 points of damage. Since you rolled a crit the total damage is now doubled and so the target suffers 34 points of damage.
If the attack involves an additional, secondary damage source which can be resisted with a saving throw (such as Poison Damage for example) it is ignored for the purpose of calculating critical damage and applied afterwards.