I do not particularly like the saying "If in doubt, lead a trump". However, that is not to say I disklike trump leads.I like trump leads too. Here are five times it's good to lead a trump.
1. Against a doubled partscore
This is the most obvious situation to lead a trump, some people even say that trump leads are mandatory here. The reason is that your side has the majority of points and want to stop declarer making the contract on ruffs. Indeed, often in a doubled partscore declarer won't have trump control so will be trying to ruff in dummy and his own hand.
Here's an example from the Peebles Congress, where me and Anna were on defence against 2♠x. We both squandered chances to lead trumps, and embarrassingly let declarer make an impossible contract.
I had the West hand and opened 1NT, showing 12-14. Anna sitting East has a 10 count, so passes for now. South comes in with 2♣, showing at least 5-4 in the Majors. North picks 2♠ as his better major, and Anna now doubles this. We have a nice agreement that after one partner opens or bids 1NT or 2NT the other partner can double for penalties. Hence Anna has an easy double of 2♠. She's not doubling based on trump strength (she only has three, I have maybe only two), but based on our combined points and two balanced hands.
Anna's trump holding of ♠QT4 isn't very appealing to lead from, but as Sally Brock (I think) says, when a trump lead is right you should do it anyway. If Anna does lead trumps, and we keep leading trumps, declarer is restricted to two top Spades and a long Spade, the ♥A and a Heart ruff and the ♦K, for 2♠x-2. However, Anna went for the ♣Q. Declarer played the ♣K and I won my Ace in dummy. Criminally, I now continued Clubs. In the end declarer won two top Spades and two Spade ruffs in hand, ♥A and two heart ruffs, and the ♦K for 2♠x=.
The only good news is that on the other table our team mates made an excellent 3NT on the East-West cards (after North leads a Diamond declarer knocks out the ♥A and is home).
Leading a trump to cut down on ruffing is also a good idea when the opponents are in a sacrifice, such as a doubled 5♣.
2. Against a pass-or-correct auction
If responder is offered two suits and picks one of them, he must be short in the other suit, so have ruffing value. This is a made up example that makes the point really clearly.
West opens 1♥, and East replies 1♠. West then rebids 2♦ and East corrects to 2♥. With equal length East would also bid 2♥, but here with longer Hearts than Diamonds it's clear to bid 2♥. On a non trump lead declarer can ruff two Diamonds in dummy.
For a real life example from the Glasgow Bridge Club see the deal at the end here.
3. Whenever dummy's strength is ruffing value
Andrew Robson says that you should think about how dummy is going to get extra tricks. It might be because they have a long powerful suit (in which case be aggressive and try and take your tricks in the other suits), or it might be because they have ruffing value. If you think dummy has ruffing value, lead trumps.
Here's the example deal from Andrew Robson's book, Bridge Lessons: Defence available here.
South opens 1♠ then rebids 2♠. Then North raises to 4♠. West is on opening lead, and with his Clubs knows that declarer is not getting discards on dummy's Clubs. Instead, the main threat from dummy must be ruffing value. So West had to lead a trump. This works well. As long as the defence continue trumps declarer now can't ruff a Heart and must go one down.
4. Against a grand slam
If the opponents bid up to a grand slam in a suit, it almost certainly means that they have all the top trumps, either because they've been through RKCB or one of them has a massive hand with the AKQ of trumps in it. Hence a trump lead is safe, and gives nothing away.
This time you are leading trumps not because you think it'll be good, but just because it won't cost anything.
5. Against a 4-4 fit
When the opponents have a 4-4 fit they are certainly going to gain tricks by ruffing in one hand or the other. A trump lead can thwart that.
Here 4♥ is almost certainly on a 4-4 fit. You can tell this as both West and East have bid another, longer, suit first. And since both West and East have a long minor and four Hearts, it's likely they have shortage somewhere. So a trump lead is often good.
For more on leading against 4-4 fits see this article by Brent Manley.