The ready action lets you prepare to take an action later, after your turn is over but before your next one has begun. Readying is a standard action. It does not provoke an attack of opportunity (though the action that you ready might do so).
Readying an Action
You can ready a standard action, a move action, or a free action. To do so, specify the action you will take and the conditions under which you will take it. Then, any time before your next action, you may take the readied action in response to that condition. The action occurs just before the action that triggers it. If the triggered action is part of another character’s activities, you interrupt the other character. Assuming he is still capable of doing so, he continues his actions once you complete your readied action. Your initiative result changes. For the rest of the encounter, your initiative result is the count on which you took the readied action, and you act immediately ahead of the character whose action triggered your readied action.
You can take a 5-foot step as part of your readied action, but only if you don’t otherwise move any distance during the round.
Initiative Consequences of Readying
Your initiative result becomes the count on which you took the readied action. If you come to your next action and have not yet performed your readied action, you don’t get to take the readied action (though you can ready the same action again). If you take your readied action in the next round, before your regular turn comes up, your initiative count rises to that new point in the order of battle, and you do not get your regular action that round.
You can ready an attack against a spellcaster with the trigger "if she starts casting a spell." If you damage the spellcaster, she may lose the spell she was trying to cast (as determined by her Concentration check result).
Readying to Counterspell
You may ready a counterspell against a spellcaster (often with the trigger "if she starts casting a spell"). In this case, when the spellcaster starts a spell, you get a chance to identify it with a Spellcraft check (DC 15 + spell level). If you do, and if you can cast that same spell (are able to cast it and have it prepared, if you prepare spells), you can cast the spell as a counterspell and automatically ruin the other spellcaster’s spell. Counterspelling works even if one spell is divine and the other arcane.
A spellcaster can use dispel magic to counterspell another spellcaster, but it doesn’t always work.
Readying a Weapon against a Charge
You can ready certain piercing weapons, setting them to receive charges. A readied weapon of this type deals double damage if you score a hit with it against a charging character.