How can I cast a spell?

Can I cast a spell after a certain part of the stack in MTG has been resolved?

The short answer: you resolve effects on the stack one at a time, and everyone has a chance to put new things on top of the stack before resolving the next effect.

More detailed answer: The Magic-Comp rules use a system called "priority" to determine when you have the opportunity to play skills and put things on the pile. In general, you can always respond to an event that changes game status, but players can do so in a defined order.

For our mutual convenience, I'll be blocking all of Section 116, Timing and Priority, and then the critical parts fat to mark.

116. Timing and priority

116.1. Unless a spell or ability instructs a player to take an action, a priority system determines which player can take actions at a particular time. The player with priority can cast spells, activate abilities and perform special actions.

116.1a A player can have a Cast instant spells when it has priority.A player can cast a non-instant spell at any time during their main phase if they have priority and the stack is empty.

116.1b A player can activate an activated ability at any time if he has priority.

116.1c A player can take special actions at any time if he has priority. A player can take other special actions at any time during their main phase if they have priority and the deck is empty. See rule 115, “Special Promotions”.

116.1d A player can do one Mana ability activate whenever it has priority, whenever it casts a spell or activates an ability that requires a mana payment, or whenever a rule or effect requires a mana payment (even in the middle) to cast or resolve a spell or activate an ability or dissolve) .

116.2. Other types of skills and actions are generated or performed automatically by the rules of the game or by non-priority players.

116.2a Triggered abilities can trigger at any time, including while a spell is being cast, an ability is activated, or a spell or ability is resolved. (See rule 603, “Dealing with Triggered Abilities.”) However, nothing happens at the time an ability is triggered. Every time a player is given priority, any ability that triggered but hasn't been put on the stack is put on the stack. See rule 116.5.

116.2b Static skills continuously affect the game. The priority does not apply to them. (See rule 604, “Using Static Abilities,” and rule 611, “Continuous Effects.”)

116.2c Turn-based actions are automatically performed when certain steps or phases begin. They are dealt with before any player is given priority. See rule 116.3a. Turn-based actions are also performed automatically when each step and phase ends. No player is given priority thereafter. See rule 703, “Turn-Based Actions”.

116.2d State-based actions are carried out automatically when certain conditions are met. See rule 704. They are dealt with before a player is given priority. See rule 116.5.

116.2e Resolving spells and abilities can instruct players to make decisions or take action, or allow players to activate mana abilities. Even if a player does so, neither player has priority while a spell or ability is resolving. See rule 608, “Resolving Spells and Abilities”.

116.3. Which player has priority is determined by the following rules:

116.3a The active player is given priority at the beginning of most steps and phases after all turn-based actions (e.g. drawing a card during the drawing step; see rule 703) have been dealt with and abilities that trigger at the beginning of the phase or step have been put on the stack placed. No player is given priority during the untap step. Players are usually not given priority during the cleanup step (see rule 514.3).

116.3b The active player is given priority after a spell or ability (other than a mana ability) resolves.

116.3c When a player has priority when casting a spell, activating an ability, or taking a special action executes , this player is then given priority.

116.3d When a player has priority and no actions executes, fits this player. If there is mana in that player's mana pool, he or she announces what mana is available. Then the next player in turn is given priority.

116.4. If all players pass in turn (that is, if all players pass without taking any action between passes), the spell or ability on top of the stack is resolved, or if the stack is empty the phase or step ends.

116.5. Each time a player is given priority, the game first takes all applicable state-based actions as a single event (see rule 704, “State-Based Actions”) and repeats this process until no more state-based actions are taken. Triggered abilities are then put on the stack (see rule 603, “Handling Triggered Abilities”). These steps are repeated in sequence until no further state-based actions are taken and no more skills are triggered. Then the player who would have been given priority does so.

116.6. In a multiplayer game with the "Joint Team Rounds" option, teams have priority over individual players. See rule 805, Shared Team Turns Option.

116.7. If a priority player casts a spell or activates an activated ability while another spell or ability is already on the stack, the new spell or ability was cast “in response to” the previous spell or ability or activated. The new spell or ability is resolved first. See rule 608, “Resolving Spells and Abilities”.

How about an example?

Alice and Bob are playing. They're trying to brush up on the technical game so be sure to follow every little step to be ready for tournaments and judges.

It's Alice's main phase.

As an active player Alice priority .

Alice throws fireball. She moves the card from her hand onto the pile for all players to see. It determines the parameters (the value of X, how many targets it will have). She pays all costs, in this case by typing her mana. Now Fireball is on the stack.

Alice gets priority because she just put an effect on the stack. Consist.

Bob is given priority . Bob acts Snapcaster Mage. Same thing: put the card on the table, choose any parameters (none while casting: you target its ability after it comes into play) and pay the cost. Snapcaster is now on top of Alice's fireball.

Bob gets priority because he just put an effect on the stack. If Bob wanted, he could play a different (instant) spell or ability at this point. He decides to insist.

Alice gets priority since she is the other player and Bob passed. Alice goes by. (Note that after Alice passes, Bob does not get a chance to put anything new on the pile, since he has already passed as well.)

After both players pass, they solve the top item on the stack, which is Bob's Snapcaster. The Snapcaster mage spell will be resolved and becomes a Snapcaster mage creature on the battlefield. Its "comes into play" trigger goes on the stack. Bob chooses a target for this: the mana leak in his graveyard. The stack looks like this: Snapcaster Mage Trigger, Fireball.

Alice gets priority because a spell has just been released. If she had a surgical extraction, she could put that on the stack above the Snapcaster's trigger to remove the mana leak before it has a chance to resolve. Unfortunately no dice. So it will last.

Bob gets priority . Consist.

Since both players have passed, they solve the topmost one on the stack. Snapcaster Mage's ETB ability will be terminated . Bob's Mana Leak now has Flashback 1U. The only thing on the stack is fireball.

Alice gets priority because a triggered effect has just been resolved. Consist.

Bob gets priority . If it fits now, the fireball will go off. Instead throws Bob Naturally Mana leak from his graveyard: Bob pushes Mana Leak onto the stack, targets Fireball, and pays his flashback cost by tapping Mana. Now Mana Leak is on top of the stack above Fireball.

Bob is given priority, because he just played a spell. If he wanted to put another spell on the stack over Mana Leak, he could do it now. Consist.

Alice gets priority . Consist.

Both players passed and now will Fixed mana leak . During the dissolution, Alice has the option to pay 3 mana to stop it. She refuses. (If multiple players had decisions to make - such as when you were resolving smallpox, you would go in APNAP order, just as you would after an effect resolves.) Then Mana Leak counters the fireball. The fireball is removed from the stack (goes to Alice's graveyard). Since Mana Leak was occupied with flashback, Bob places the card in the exile zone. Now the pile is empty.

Alice gets priority because a spell has just been released. Since the deck is empty and it is her main phase, she can play any spell she wants, not just moments. Alice goes by.

Bob gets priority . Consist.

Both players passed with an empty pile, so let's move on to the next step or phase (i.e. fight if this is Alice's first main phase).