Aristophanes is arguably the best-remembered of the ancient Greek comedy writers. 11 of his plays have survived in full, compared to 6 partially-surviving works by Menander and fragments by several others. But there is no evidence that he was extraordinarily popular in his time. Like others writers of his time, his theatrical plays competed for awards in festivals, and he often lost. The fact that medieval copyists chose to preserve his works is a testament to his continued appeal. Of his surviving plays:
The Acharnians (425 BC), The Knights (424 BC), and The Frogs (405 BC) are known to have won the first prize in contests. With the Frogs being popular enough to warrant a repeat performance, extraordinary for its time.
The Wasps (422 BC), Peace (421 BC), and The Birds (414 BC) took second place. A testament to Aristophanes having harsh competition in the persons of Cratinus and Eupolis. The later two remained popular to Roman times, and Macrobius (5th century AD) even commented: "Everyone knows Eupolis". Unfortunately, the Medieval copyists chose to ignore these two authors for unknown reasons.
The Clouds (423 BC) came last in a contest and was poorly received by the audience. Aristophanes later revised it considerably, adding comments on the unpopularity of the earlier version. Today only the revised version survives.
There is no information on whether Lysistrata (411 BC), Thesmophoriazusae (411 BC), Ecclesiazusae (Assemblywomen) (c. 392 BC), and Plutus (c. 388 BC) were successful or not. For all their modern fame, these plays seem to have been obscure in antiquity, resulting in few comments by later writers.
Euripides suffered much the same fate in drama- he only won the yearly drama competition four times in his life (compared to Aeschylus's 13 and Sophocles's 20+) yet almost 20 of his plays survived to today (Aeschylus and Sophocles have seven each) and many of his plays are considered well ahead of their time socially.
From what we can tell, William Shakespeare wasn't thought of as the pre-eminent playwright of Elizabethan and Jacobean theatre at the time, although he seems to have been well regarded and reasonably famous. Only in the late 18th century did scholars start to pay serious attention to Shakespeare. Up until then, most of the praise had been for Ben Jonson and the (now largely forgotten except by academics) collaboraters Francis Beaumont and John Fletcher.
Two of his plays, The Merchant of Venice and Macbeth, fared particularly poorly when first introduced, with less than a half dozen 17th-century performances on record. Four centuries later they are two of The Bard's most celebrated plays.
Othello was also a bomb in the Elizabethan period. Nowadays, it is second only to Hamlet as the most-performed work of Shakespeare.
Moliere's most celebrated work is The Misanthrope, which played to poor sales and dismissal during its initial run in the 1660s.
Gilbert and Sullivan's Ruddigore was initially considered a failure when put on in 1887. This verdict is somewhat harsh, since it was run directly following The Mikado. It did actually enjoy a bit of success later on in the run, but it wasn't put in the regular Gilbert and Sullivan canon until the 1920s where it has remained ever since.
Anton Chekhov's The Seagull is an interesting example. The premier of the play in St. Petersburg was a complete disaster with the audience almost universally booing to the point where actress Vera Komissarzhevskaya ended up losing her voice trying to project over the boos and Chekhov himself having to leave the audience to take refuge backstage, fearing for his life. The reception was so bad that, the next day, Chekhov would tell newspaper writer Aleksey Suvorin that he was quitting playwriting. Years later, the initial criticism died down and people began to appreciate it with Constantin Stanislavski's direction of it going over incredibly well in 1898. Today, it's now regarded as one of Chekov's best plays.
Arthur Miller emerged from the smash-hit release of Death of a Salesman as one of Broadway's biggest playwrights. Shortly thereafter, Mc-Carthyism and related 50s political turmoil wreaked havoc on Miller's career. The Crucible made the mildest of profits and A View from the Bridge completely tanked, although both are celebrated today as major pieces in Miller's profile.
Sarah Kane's first play, 'Blasted', was victim to many a negative critic for its use of violence. It wasn't until her suicide and posthumous performance of her last play '4.48 Psychosis' that many of these critics withdrew their complaints.