I think most writers are aware of their audience even from the start. Many probably aren't actively thinking about it while writing, but we tend to fit ourselves into a genre and category. Then, once we've finished writing and are moving forward into prepping for publication, the intended audience becomes a very important thing to consider. Genre and category really are the first and foremost things to be aware of, because those are the qualifications around which your book will be marketed and pitched. They impact the entire business part of your career.
Many big professionals in the field, however, recommend that you think in even more detail about your intended audience. You should create a profile for your reader: not just age and genre preference, but also gender, ethnicity, hometown, hobbies, lifestyle. Obviously, the great majority of your readers are not going to fit this exact profile, but it will help you focus in on what elements in your story you need to emphasize in order to optimize the read for that specific intended reader.
I never really thought much about this until one day in American Foundations last semester. We were discussing the American Revolution, and the professor explained how we have this bias against England because we're taught about the Revolution from childhood, as like a big deal with us gaining our freedom. In fact, England was one of the freest places in the world even as America separated.