Macros read from left to right, and the first “true” conditional will be what happens. Think of them as a series of if/then/else statements. It can take a bit of practice, but once you get the hang of it, you can get a lot of control over how things cast.
Here are some examples to give you an idea of how macros are parsed by the game:
The macro I posted:
#showtooltip
/cast [mod:shift]Death's Advance; [talent:5/2] Wraith Walk; [talent:5/3] Death Pact; Death's Advance
IF holding the shift key, THEN cast Death’s Advance
ELSE IF talent 5/2 is selected, THEN cast Wraith Walk
ELSE IF talent 5/3 is slected, THEN cast Death Pact
ELSE cast Death’s Advance
If we do the same thing with your original macro
#showtooltip
/cast [nomod:shift][talent:5/2] Wraith Walk; [talent:5/3] Death Pact; [mod:shift] Death’s Advance
IF shift is not held, THEN cast Wraith Walk
ELSE IF talent 5/2 is selected, THEN cast Wraith Walk
ELSE IF talent 5/3 is selected, THEN cast Death Pact
ELSE IF shift is held, THEN cast Death’s Advance
As you can see, it won’t behave like you want. It will either get stuck on the first conditional without shift, or get stuck on whichever talent you have selected with shift. If a conditional is true, but it can’t cast the spell, the macro will just fail and stop at that point.
If you wanted to convert your original macro instead of using the cleaned up version I posted, it would look like this:
#showtooltip
/cast [nomod:shift,talent:5/2] Wraith Walk; [nomod:shift,talent:5/3] Death Pact; [mod:shift] Death’s Advance
IF shift is not held AND talent 5/2 is selected, THEN cast Wraith Walk
ELSE IF shift is not held AND talent 5/3 is selected, THEN cast Death Pact
ELSE IF shift is held, THEN cast Death’s Advance
It will work mostly the same way the one I posted will. (The big difference is that with my macro if you have talent 5/1 selected, Death’s Advance will cast with or without shift held and you won’t get a ? icon.)