Shakespeare wrote for popular and aristocratic audiences both.
Like other theater companies of the era, Richard Burbage's company (of which Shakespeare was a part) depended upon patronage by members of the aristocracy; it was known at various times as "The Lord Chamberlain's Men" and "The King's Men" to reflect who its patrons were.
Shakespeare's plays were most often performed to large crowds. The Globe Theatre and Blackfriars were built to accommodate different social classes. There were also private performances of Shakespeare's plays to the court of King James. Some of Shakespeare's plays included content aimed at pleasing his patrons; for instance, the play Macbeth, in contrast to the sources Shakespeare drew from, portrayed Macbeth's claim to the throne as entirely illegitimate, and includes a scene that is largely flattery for King James and his ancestors (that is, Macbeth's second meeting with the witches, in which they show him the line of succession of Scottish kings that leads up to King James.)
Shakespeare's intellectual background is often contrasted with Christopher Marlowe, a contemporary playwright who had been a scholar at Cambridge. However, while Shakespeare was not a university scholar, he was widely read, and his plays drew on a variety of classical and contemporary literary sources.
Of course, much of the content of Shakespeare's plays can be understood without classical education, and include physical comedy, sexual humor, and action scenes, that would appeal to a wide audience; and we know his plays drew large audiences.
Several of Shakespeare's plays include a play-within-a-play, most famously Hamlet and A Midsummer Night's Dream; the latter, particularly, gives a stylized glimpse of different social classes interacting through the theatre, and reacting to different aspects of the story.
Indeed, I've heard that Shakespeare's plays are full of vulgarity and references to sex, which would back up this idea.
Heard? Have you actually read/performed in/attended any of them? That stuff's right out there for everyone to see, and some of it's even in language that we can still understand today, such as the infamous interlude in Macbeth about alcohol and its effects on male sexuality.