Combat is cyclical; everybody acts in turn in a regular cycle of rounds. Combat follows this sequence:
Each combatant starts out flat-footed. Once a combatant acts, he or she is no longer flat-footed.
Determine which characters are aware of their opponents at the start of the battle. If some but not all of the combatants are aware of their opponents, a surprise round happens before regular rounds of combat begin. The combatants who are aware of the opponents can act in the surprise round, so they roll for initiative. In initiative order (highest to lowest), combatants who started the battle aware of their opponents each take one action (either a standard action or a move action) during the surprise round. Combatants who were unaware do not get to act in the surprise round. If no one or everyone starts the battle aware, there is no surprise round.
Combatants who have not yet rolled initiative do so. All combatants are now ready to begin their first regular round of combat.
Combatants act in initiative order until the DM goes.
Then, all of the players act. Then, the DM acts. Then, all of the players act. Then, the DM acts. Repeat until combat is over.