When and how to play trump or force your opponent to play trump is another of the many complicated questions in this game.
I’m just throwing out some thoughts here, so do not consider this complete or comprehensive. It is what it is.
If you are bid and have only three or fewer spades, you obviously want to try to stay away from a situation where your opponent can exploit a void weakness that will force you to use your few spades. There are obviously 13 spades total. If you have three, that leaves 10, your partner could easily have four which you want covered. So as you want to avoid your opponent forcing you to trump a trick you know will otherwise set your P, you may want to reconsider forcing your opponent to trump a trick to save his P. Bleeding spades can be as or more detrimental to your team as it is to the opponents.
Try to figure out the likelihood of your P’s spade situation, and the opponents’, by the size and sequence of bids.
If you are nil and you are set by reason of the king of spades, or any other spade, keep an eye on your partner’s cover to make sure that the bid is not endangered. If it appears that it might be, use your spades to best advantage. Do not necessarily first play your highest spade. Remember, a double set is always more painful than a simple nil set. (Although there are times when achieving that double set costs the opponents in serious bags, so it is not always the tragedy it seems.)
Where your P’s nil has potentially a lot of spades (4 or 5), or you have very few, it can be advantageous, if you are leading into the opps’ bid, to force them to trump for your P to duck under, so some get soaked up before spades gets run.