As others have said, the cock crows to indicate the dawn; that dawn = new hope,
etc. The cock is doing this, as Tolkien explicitly says, because he's a
cock and that's what cocks do at dawn.
All the same it's difficult to imagine that more isn't
going on here given, first, the prominent position at which the cock's crow
appears; and, second, the potency of the new dawn.
The cock's crow in folktales and even in more complicated
literary productions usually indicates slightly more than just a literal new
dawn -- it also indicates hope and, frequently enough, deliverance from horrors
and a new life. In John Milton's "Comus" (Ll. 342-349) the brothers lost
in a literal wood long to hear a cock crowing as a token of hope that they
might yet make it out of the darksome wood in which they're trapped. Tom
Shippey cites Saxo Grammaticus' Historia Danorum for a Norse legend in
which a witch guides a king to the Odainsakr, the "Field of the Undying."
To demonstrate the efficacy of this field, the witch stands at the boundary and
chops a cock's head off. She then tosses the cock onto the "Field of the
Undying" -- a moment later they hear the cock crowing: new life, deliverance
from death.
The story of Peter's denial in the gospels uses the cock's
crow in a similar way; or at least presupposes that the reader will connect
these things with the crowing.
Very briefly, after Peter has protested his absolute
loyalty to and confidence in Christ, Christ tells him that he will deny Him
three times before cock-crow, i.e. literally, before the new day dawns.
Peter does deny Christ; when he hears the cock crowing, he realises that he,
despite his boasting, has broken faith, not just with Christ but also with
Christ's teaching. The story adds to the cock's crow an element of rebuke
for lack of faith.
For Peter had given in to despair, assumed that everything
was over, that there was no hope left, would be no new dawn, no new lease on
life in the face of certain death. The cock's crow then comes as a
resounding rebuke to him for his unbelief -- by being a clear reminder of a
literal new dawn and hence, figuratively, of new hope and new life; in
particular of the new life of which Christianity assures its adherents in spite
of death.
Tolkien's cock crows -- literally -- in the face of
death. The Witch-King, after all, announces that he is Death: "Old
fool! This is my hour. Do you not know Death when you see it?
Die now and curse in vain!" Gandalf makes no answer, but at precisely
that moment the cock crows: in rebuke to "Death" and to all who (like Denethor)
gave up hope and gave in to death. The rebuke to death comes through the
literal new dawn (and the hope it symbolises) which the cock's crow
indicates. But the cock's crow also betokens new life despite
death.
__________________________________
All that is gold does not glitter,
Not all those who wander are lost;
The old that is strong does not wither,
Deep roots are not reached by the frost.
From the ashes a fire shall be woken,
A light from the shadows shall spring;
Renewed shall be blade that was broken,
The crownless again shall be king.