Take the queen. Almost always take the queen. But the day you take her without looking is the day you draw a won game, so here are the two positions worth recognising, and both of them are famous.
The rook that avoids stalemate: Saavedra, 1895
White has a king on b6 and a pawn on c6 against a rook. The pawn goes through by force, and going through as a queen is only a draw.
a Follow the rook down the d-file: 1.c7 Rd6+ 2.Kb5 Rd5+ 3.Kb4 Rd4+ 4.Kb3 Rd3+ 5.Kc2, and now Black stops checking and plays 5…Rd4, which is the trap. Promote to a queen and 6…Rc4+ arrives. White has to take it, because 7.Kb3 Rxc8 throws the new queen away, and after 7.Qxc4 the black king on a1 has no square and is not in check. Stalemate, half a point, gone.
A rook does not have that problem, and the difference is one square. A queen on c4 covers a2 down the diagonal; a rook on c4 does not. So 6.c8=R Rc4+ 7.Rxc4 and Black is not stalemated at all, he has to crawl out with 7…Ka2 into rook and king against a bare king.
Black’s real try is 6…Ra4, and then 7.Kb3 attacks the rook and steps off the c-file so that Rc1 becomes available. Black cannot deal with both: 7…Rd4 8.Rc1 is mate, 7…Ra3+ 8.Kxa3 and 7…Rb4+ 8.Kxb4 leave king and rook against a bare king, and 7…Rc4 8.Rxc4 now gives the king b1 instead of stalemate.
The position appeared in a Glasgow newspaper column in 1895, published by Georges Barbier as a draw. Fernando Saavedra, a Spanish priest living in the city, found the rook. It is the most famous underpromotion in chess and it has been in every endgame book since.
The knight that comes with check: the Lasker trap
The other case is the knight, and it turns up as early as move seven in the Albin Counter-Gambit: 1.d4 d5 2.c4 e5 3.dxe5 d4 4.e3 Bb4+ 5.Bd2 dxe3 6.Bxb4, and now the pawn on e3 goes hunting.
8
7
2
a
b
d
e
f
g
h 1 6…exf2+ and White cannot take: 7.Kxf2 Qxd1 wins the queen down the open d-file. So 7.Ke2, where the king guards d1 and looks safe. Now 7…fxg1=Q is not even check, because the bishop on f1 blocks the new queen’s line along the first rank, and after 8.Rxg1 material is level and White is still standing. The knight is a different matter: 7…fxg1=N is check from g1, 8.Rxg1 Bg4+, and the king has to step off e2, which is the one square blocking the bishop’s line from g4 to d1. The queen falls next move.
The trap carries Emanuel Lasker’s name, and the point of it is entirely that a knight can give check on a square where a queen cannot.
What to actually do at the board
Two questions before you reach for the queen, and they take three seconds together. Does a knight give check or a fork here that the queen does not? Would the new queen leave the enemy king with no legal move and no check? If both answers are no, promote to a queen and press the clock.
A drill helps more than the theory: work through a set of underpromotion puzzles once, and the shape of the exception will stick.