This is perhaps Bierce's most well known Civil War story, in part because because of a "Twilight Zone" production of it in the late 1950s or early 1960s, and it has remained popular for its surprising ending.
As your question indicates, Bierce uses several instances of foreshadowing but so skilfully directs the reader's expectations throughout the story that we can only understand the elements of foreshadowing in hindsight.
For example, when we are introduced to Peyton Farquhar, he is in the last few minutes of his life as he waits for the support to be kicked out from under his feet so that the hanging can take place. The first element of foreshadowing occurs here when Farquhar imagines freeing himself from he rope, falling into the river, and making his way home. The reader, of course, puts this down to wishful thinking.
As Bierce jumps to the recent past in which Farquhar, at his home, has a conversation about the bridge and the Federal troops with a Conferderate soldier (who turns out to be a Federal scout in disguise), Farquhar asks the soldier what could be done to interrupt the progress of the Federals. As Bierce moves us back to the present, we are at the point at which Farquhar is hanged, and so we understand that Farquhar has tried and failed to burn the bridge, is caught, and his now being executed, exactly as the Federal scout described.
The entire hanging sequence and escape is rendered in such detail that it is impossible to know that this is happening in Farquhar's imagination. An element of foreshadowing does occur in this sequence, however, that might make an astute reader pause. When, for example, Farquhar says that "he was conscious of nothing but a feeling of fulness--of congestion" in his head, he is feeling one of the first consequences of being hanged: as the noose tightens quickly, his wind-pipe is closed and the blood in his head has nowhere to go, so his head would naturally feel full and congested. A few seconds later, after the believes the rope has broken and he has fallen into the river, he comments that "his neck ached horribly; his brain was on fire. . . his whole body was racked and wrenched with an unsupportable anguish!" This, again, is an element of foreshadowing because he is accurately describing the sensations a hanged person would feel if his neck did not break in the initial fall when he support is removed from his feet and he is suffocating to death. At this point, the reader still expects that this sequence is depicting reality because what Farquhar is feeling is consistent with the trauma of even an unsuccessful hanging.
Immediately after he comes to the surface, his unusual ability to sense even minute sounds and sights around him, even to the point of seeing the color of a soldier's eyes yards away from him, should give us perhaps our first serious concern that something very unusual has occurred to him. Also, in such a situation, an officer would not give his troops formal instructions to fire at the escapee as Farquhar hears: "Attention, company! . . . .Shoulder arms! . . . .Ready! . . . .Aim! . . . Fire!" The soldiers would be shooting as fast as they could and without formal orders.
Lastly, when he reaches home, the greeting of his wife, as if he had just been out for a walk, seems, under the circumstances, not demonstrative enough for a greeting of a husband who has been hazarding his life for the last several hours, another instance of foreshadowing.