Some spells, activated abilities, and triggered abilities read, "[Do something]. If [a player] [does, doesn't, or can't], [effect]." or "[A player] may [do something]. If [that player] [does, doesn't, or can't], [effect]." The action [do something] is a cost, paid when the spell or ability resolves. The "If [a player] [does, doesn't, or can't]" clause checks whether the player chose to pay an optional cost or started to pay a mandatory cost,
regardless of what events actually occurred.
Example: Your opponent has cast
Gather Specimens, a spell that says "If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead." You control a face-down
Dermoplasm, a creature with morph that says "When Dermoplasm is turned face up, you may put a creature card with morph from your hand onto the battlefield face up. If you do, return Dermoplasm to its owner's hand." You turn Dermoplasm face up, and you choose to put a creature card with morph from your hand onto the battlefield. Due to Gather Specimens, it enters the battlefield under your opponent's control instead of yours. However, since you chose to pay the cost, Dermoplasm is still returned to its owner's hand.