When you cast a spell, you must pay costs associated with playing a spell at that time. This will be before anyone will receive priority to play anything else or perform any other actions. Costs include the mana cost, and any additional costs. (Keep in mind that some costs are associated with keyword abilities.
For example, when you cast Artillerize you must sacrifice an artifact or creature. Just as with mana costs, if Artillerize become countered, either by an effect or the rules of the game, then you will not get that sacrificed permanent back. You do not wait until your opponent choose to let this spell resolve and then perform the sacrifice.