When and how do you use suit preference signals in bridge?
There are LOTS of suit preference (abbrev: SP) situations, as well as many agreements as to when SP applies. I'll see if I can cover at least a few of them.

The classic one is as you have described. On opening lead, you lead an obvious stiff in a side suit against a trump contract. (Of course, there is little reason to do this if you have a void in trumps.) Partner, who happens to win the trick, returns a card, expecting you to ruff. 

When you do ruff that card, which suit do you return? Look at it like this, if you ruffed, you don't have any more of that suit, and trumps seem like a bad idea. After all, you are hoping to get partner in for a second ruff! So essentially there are other two suits of potential interest as an entry. Ranking them in the standard order from low(clubs) to high(spades), partner can indicate their re-entry suit.

The idea is, partner will give you a low card to ruff with an entry in the low side suit, and a high card for you to ruff with a high side suit entry. If partner has NO entry at all, then they should (if possible) return an intermediate card, suggesting no preference.

By the way, suit preference applies for you too! In fact, both sides of the partnership will often be giving suit preference signals. Let us see how this would all work on an example hand.

Your opponents are in a 4S contract, played by that hapless fellow in the South seat.

Perhaps the bidding went: 1♦ - 1♠ - 2♠ - 4♠, with you never having an opportunity to show your diamond length.

     Declarer
     AKT9
     A73
     T6
     QJ53

You        Partner
73         Q52
KJ8        642
A98432     J
A7         T98642

     Declarer
      J864
      QT95
      KQ75
      K


You have few good good looking leads here, so with a prayer in mind, you pick the diamond ace for your lead, partner playing the jack. (Yes, I know that aces are terrible leads, but that is not the point of this hand, and your other leads are equally bad). Anyway, if declarer has diamond length from the bidding, the chances are very good that your partner is short in that suit.

If partner had a stiff diamond jack, she will be able to ruff the next trick, so what return are you looking for? A club is your quick entry, so at trick two, you lead the deuce of diamonds.

Partner ruffs of course. Your diamond deuce is a clear signal, asking for a club return. At the same time, partner is looking for a third diamond lead. That card gives partner a second ruff, promoting the queen of trumps back into a winner. See that partner had a natural trump trick, but the ruff would allow declarer to draw trumps with the ace and king. So a third round of diamonds will be a trump promotion for partner.

How does partner indicate a suggestion for you to lead a third diamond? When partner returns the indicated club card, she will lead the DEUCE. The low return tells partner to lead the LOW suit when they are in at trick 3, so diamonds!

You have taken the first 3 tricks in a flurry now. At trick 4, when you lead a card for partner to ruff, what diamond do you play? You don't want to see a club return. Instead you would prefer a heart, hoping to set up a heart trick. The way to ask for hearts is to play the 9 of diamonds on that third round of diamonds. The high card asks for the high suit. While declarer gets two pitches on the club winners, there is still a heart to lose, so you set 4S two tricks. This is a top score at match-points of course.

Note that there were several SP plays in the defense of this one hand, made by both opponents.

The classic SP situation discussed so far is not the only case where they can apply. Visualize a hand where we have bid and raised a suit, but the opponents end up as the declarer. As the opening leader, imagine that your hand is

J
K85
Q9762
AQT8


As dealer (West), you open the bidding 1♦, only to see the bidding go:

1♦ - Dbl - 2♦ - 4♠
All pass


So partner has raised your diamonds, but the opponents still found game. It looks like South has bid game on shape, since there are simply not enough points to go around for South to have bid it on power. Your hope is to beat this contract, but when they bid game on shape, all bets may be off.

You lead your 4th best diamond, partner winning the king. Dummy comes down with a decent hand, as it has top tricks, but still a basic minimum for a takeout double.

     Dummy
     AKT9
     AT73
     43
     J52
You
J
K85
Q9762
AQT8


Partner then cashes the diamond ace as declarer followed suit with the 8 and 10. You don't expect to see much more in partner's hand, but you really want a club switch through the probable king in declarer's hand. After all, if partner had the AK in diamonds, plus the club king, they might have found a different bid than simply 2♦. So on the second diamond, what card do you play to ask partner to continue with a club? Your choices were {Q,9,7,2}. You and partner both know that a diamond continuation is not right. Partner sees you play the deuce, so your 4th best lead indicates that declarer had only a doubleton.

There are two side suits here, hearts and clubs. If you play a clearly low diamond (the deuce), then this must be SP for clubs. You get your 4 tricks to defeat the contract. It turns out that the hands were like this:

     Dummy
     AKT9
     AT73
     43
     J52

You        Partner
J          5
K85        9642
Q9762      AKJ5
AQT8       9643

     Declarer
     Q876432
     QJ
     T8
     K7


If you don't get a club switch at trick 3, Declarer can draw trumps, then take the heart finesse to make game.

But, now suppose the hands were slightly different?

     Declarer
     AKT9
     AT73
     432
     J5

You        Partner
J43        52
KJ8        9642
Q9762      AKJ
A7         9643

     Declarer
     Q876
     Q5
     T8
     KQT82


With South still in a 4♠ contract, after East wins the first two tricks, what should he return? A club, diamond or spade return gives declarer the contract, by allowing her to set up clubs for three heart pitches. Only the heart switch through declarer sets up a heart trick in time to set the contract.

Can West ask for a heart switch? Of course. On the second diamond, play the QUEEN. This is a stand up and shout suit preference play, asking for a switch to the higher side suit.

Finally, I might change the hands yet again. (I tried to get the spot cards right on all of these hands.) Again, assume that South is declaring 4♠, although the bidding is surely not the same as it was before.

     Declarer
     AK94
     AT63
     432
     J5

You        Partner
QJT        32
K87        9542
Q976       AK5
T87        K643

     Declarer
     8765
     QJ
     JT8
     AQ92


On a 4th best diamond lead, East wins the king, then the ace of diamonds. Clearly, they must cash the third diamond trick, at which point West will have a natural trump trick. But from East's point of view, should he switch to a club, a heart, or continue diamonds? On the last two hands, with very similar looking hands for East, he had to switch to one of the other suits, and NOT continue diamonds to defeat the contract! Declarer has played the same cards each time, the 8 and ten spot.

On this hand, you led the 4th best 6. By continuing with the 7 at trick 2, partner will expect that you had a 4 card suit, so will hopefully continue diamonds. Any other continuation will allow declarer to take the heart finesse for a diamond pitch, so this was necessary.



Those were the classic suit preference situations, but there are others. One agreement I have with several partners is that when you lead a card and it is absolutely clear that you don't want to continue that suit, then partner will signal with suit preference. For example, in a trump contract you lead a winner, and dummy has a stiff in the suit. Continuing the suit seems not to be useful, so what side suit do you switch to? Partner should signal with suit preference. Or, perhaps, your lead of a stiff ace discloses a solid unbid side suit in dummy that you have just set up. Again, partner should indicate suit preference for your next lead.

There are several suit preference discarding agreements that many pairs use. The most common are Lavinthal discards, and odd/even discards. While I've never been a fan or either agreement, they are commonly employed.

Lavinthal: On your FIRST discard in the hand (and only on your first opportunity to discard) you throw a card in a suit that you are NOT interested in. A high card indicates interest in the higher of the other suits, and a low spot indicates interest in the lower suit.

Odd/even: Again, at your first opportunity to discard, you pick a side suit to play. An odd card indicates that you like the suit. An even card is suit preference, with a low even card suggesting a preference for the lower of the other suits. A high even card is a preference for the higher suit.

A serious problem with both of the above discarding agreements, is that sometimes you have no spot cards that you can safely throw away that show your true holding. Then what happens is a defender tanks, agonizing about which card they should play, which lie to make. Partner can read what is happening of course, so they will discount your signal, since a card played in tempo will not carry any inference. Of course, it is COMPLETELY illegal to use tempo information from your partner, but there has been many a director called, many a committee formed over just such an occurrence.

And finally, there are trump suit preference signals, where the order that you play your spot cards in trumps tells partner about your side suit holdings.

Of course, these are dangerous territories to enter into, as a good declarer can also read your signals, often to disastrous effect. Don't make a signal if it will tell partner nothing useful, but give the hand away to declarer. And don't agree to any such agreements if you cannot play your cards in tempo, as that is simply asking for problems.