The sentence starts with a regular tone describing what the child doing: "staring out through the open window". At this point the reader is just picturing a child doing exactly that, but with the use of the preposition "with" includes an interesting detail that drastically changes the scenario. This child is not just harmlessly staring out the window but she is doing so "with a dazed horror in her eyes," this is the turning point where we see how this element of surprise alters the entire perspective and expectation the reader has about this story from now on.
In chapter 8 of the Red Badge of Courage, the thing that caused Henry to turn back to the frontline after fleeing is that He heard loud noises and was curious.