In the song “Stand by Me”, we see a sentence like “when the night has come.”
I was taught that in a when clause, we use the past tense, yet the present perfect has been used in the sentence cited above. Why is that?
Let's look at a little more context:
A perfect construction marks a past action as having brought about a state which is relevant at some later point: the utterance’s ‘Reference time’.
In the utterance at hand, that Reference time is defined by the main clause—I won’t be afraid—as some sort of ‘future’. (It may be an actual temporal future, or a ‘consequential’ future; that doesn’t really matter.) This future is expressed using the present tense of will, so the state of night and darkness is expressed using present constructions: The night has come, the land is dark, the moon is the only light.
The perfect construction is employed in the first phrase to signify that night is not in the process of falling: it is not dusk, when light is fading, but already full night, when the light is gone. The state of night is fully realized.
I wish to say that Stoney's answer is the one I would vote for. So, my answer is but chipping in my 2 cts.
We could look at this with the event-state flow diagram.
An example of event-state is
When the state of the crate is filled, it means that the fill-crate event has completed, aka perfected.
Therefore, when state = [land is dark], it means the event [night comes] has completed, i.e., the night has come.
Therefore, when using the present perfection of events, it is used in conjunction with present states and future possibilities.
The event completion need not be related to any arbitrary present states that may be stated in conjunction of each other.