'Even though I walk through the darkest valley, I will fear no evil, for you are with me.' Preachers have long noticed David's word: shadow. A shadow can frighten, but a shadow cannot bite, cannot strike, cannot hold you. And a shadow only exists where there is light on the other side of the object casting it.
The valley is real — David does not deny the darkness — but what reaches you in it is only a shadow, because the Shepherd stands between you and the worst of it, rod and staff in hand. Notice too the pronoun shift in the psalm: in the green pastures David talks about God ('he leads me'); in the valley he talks to God ('you are with me'). Trouble often turns theology into prayer.