Finding the right colour for painting shadows can be quite challenging; most beginners intuitively tend mix black and gray to reproduce shadows, however, this procedure make the paint look muddy.
Thus, is better to avoid using black or gray to darken hues.
Most commonly, the colour of a shadow will be of a darker tone of its surface, so for instance, a shadow on a red table will be of a darker tone of red. However, keep in mind that the object reflecting the shadow will also influence it.
Imagine, for instance, that you need to paint the shadow of a green book reflecting on a red table. To produce the correct colour, use the red hue of the table and mix it with a little bit of its complementary colour green - this will give you the desired darker red without having to mix black or gray; shadows, in fact, generally assume more or less the complementary colour of its surface.
When painting ‘alla prima’ you can even paint pure strokes of green (reflecting from the object) and gently blend it with the main wet colour, but make sure that you do not blend too much, as you want to leave some of the green strokes visible.
When glazing, however, it is important that the colour on which you want to apply the shadow is completely dry. For example, to reproduce the shadow on a red table, apply a very transparent layer of green (complementary of red) on a properly dried surface. Repeat this procedure until you obtain the desired effect (make sure that each layer of colour is completely dry before you apply the next one).
Keep in mind that art rules are not set in stone and in some cases you will have to use your own judgment depending on the situation and context.
Also, remember that colour is not static but is influenced by many different things such as lighting, as well as ambient/context and other objects/ surfaces surrounding it.