The role of the audience in a performance is partly one of consumer. The audience is the consumer of the product, in this case a play or a movie - in music it could be a concert, show or opera.
The audience is the body of theatre-goers the playwright had in mind when he/she wrote the play. This can vary widely from what one might think - and through history. For example, Shakespeare had to keep in mind the monarch (Queen Elizabeth was very different from King James who had an interest in witches and withcraft.) Sometimes plays were commissioined with the sole purpose of pleasing/entertaining a monarch, and then went public or on tour afterwards. Sometimes plays are popular with an audience segment the author had never envisaged.
A more mdern example would be 'Educating Rita' by Willy Russell. This play 'went down a storm' in a country where the class system and educational injustices were gradually being worn down partly through a more socialist attitude to education.
The role of the audience could also be to encourage the actors through their appreciation and applause.
The audience also acts as a barometer for public opinion about the play. In our contempoarary world, most plays are staged to generate revenue. It doesn't matter what the critics think...if no-one wants to go see it, the show will dive and close.