What is the purpose of the imaginary adversary?
Well, first it's important to realize that the "imaginary adversary" that you ask about in your question is actually a proper noun and character in this story. As a character, it is referred to as the Invisible Adversary. The purpose of the Invisible Adversary to Gretchen is to provide a companion suited to her stalking behaviors; however, the purpose of the Invisible Adversary for the author (and for the reader) is to show how psychologically disturbed Gretchen truly is to fully disregard all of humanity.
First, let’s explore the Invisible Adversary’s purpose according to Gretchen. Gretchen needs someone to stalk so that she can laugh with evil at behaviors as she commits destructive acts herself (such as shoplifting and destruction of property). You are right to say that the Invisible Adversary is “imaginary” in that Gretchen has created this invisible playmate per se, in order to continue her scoffs at humanity. Truly, the Invisible Adversary is the only other character that Gretchen interacts with. We see Gretchen avoid her mother and simply destroy property after being bumped into by some young men. In some ways, the Invisible Adversary makes Gretchen’s destructive games more fun by taunting her to do more and by waiting for her while she eats lunch.
However, most readers figure that the purpose of the Invisible Adversary is much more interesting when we consider the author and the readers. The Invisible Adversary is totally imaginary and was created by Oates for us to see just how psychologically disturbed Gretchen is. The best evidence of this is the end of the story when the Invisible Adversary runs out in front of a car and is hit. Blood is everywhere. Gretchen follows and laughs, then sits down to watch a repeat television show, not caring what happens to her beloved Adversary. Gretchen’s violence and lack of compassion are meant to be truly chilling to the reader.
In conclusion, we realize that the purpose of the Invisible Adversary is different for Gretchen vs. the author and the reader. No matter which purpose we focus on, we should come to the conclusion that Gretchen truly suffers from some severe form of mental illness that makes her flee from human contact and nix compassion.