Whenever a player receives priority to cast spells, play abilities or perform a special action the game will check to see if one of the 20 conditions for a states-based actions has been met. (Yes there are 20 now, a few of them only apply in specific multiplayer formats) If not, then the appropriate player will then receive priority. If one of the state-based actions is performed, then another check is done to see if another state based action needs to apply.
State-based actions are never checked during the resolution of a spell or ability, only before or after.
State based actions are also checked in the cleanup step of each turn. If a state-based action is performed, then players will receive priority in this step. If not, then the game will advance to the next turn.