In Shakespeare's Hamlet, a troupe of actors arrive at Elsinore, the castle of the King of Denmark. In Elizabethan times, the audience would have been aware of the concept of traveling actors as it had been done in small towns since medieval times; originally dramas were presented by the Church. Then independent actors started to travel together, even to form guilds (like unions), and they would go from town to town, or (if fortunate) to castles. This is much the way bards (storytellers) functioned. If a traveling acting troupe (or bard) were fortunate enough to be welcomed into a castle, they would be housed and fed as long as they had material to perform. So being invited to stay is a excellent good fortune for the actors.
For Hamlet, he will use the actors to perform a scene much like his father's murder in order to watch Claudius' face. If the King has a guilty reactions to the unusual circumstances enacted—especially the poison poured into the actor king's ear, etc.—he believes he will finally have his proof of the king's culpability in Old Hamlet's death and finally be able to avenge his father's death without offending God.
Hamlet is probably also interested in the actors' good treatment in that he seems to be prone more to kindness than ill-intent. For example, he has to pretend to be mad to gain information; this also includes acting as if he does not care for Ophelia, when he still does. Just after the Yorick speech in the graveyard scene with Horatio, we see the depth of his love for Ophelia. With this in mind, we can understand Hamlet's desire to have the actors treated well is two-fold. As the responsibility falls on Polonius to at least make these arrangements, Hamlet reminds him it is smart to be nice to actors. Because it would be better to have a bad epitaph (an inscription on one's gravestone, or a speech at one's funeral) than the ill-will of actors. (This may well have been an "inside" joke with the audience about treating actors with generosity or kindness.) For if a person treats actors poorly, "they are the short stories and brief history of the time" and it would be advantageous for actors to speak well of person while he is alive as opposed to having others think badly when he is dead.
Good my lord, will you see the players well
bestow'd? Do you hear? Let them be well used; for they
are the abstract and brief chronicles of the time. After
your death you were better have a bad epitaph than their ill report while you live. (II.ii.512-515)
To this, Polonius states:
My lord, I will use them according to their
By saying this, Polonius states that he will treat them as they deserve.
Hamlet's response is to treat them better than that. He explains that if everyone were treated as he deserves, all men would be flogged (inferring that some men are treated better than they deserve). He instructs Polonius to treat them as one of Polonius' class. The less they deserve this treatment, the better Polonius will be perceived. (In other words, doing so can only make Polonius look good.)
God's bodykins, man, much better! Use every
man after his desert, and who shall 'scape whipping? Use them after your own honour and dignity. The less they deserve, the more merit is in your bounty. (II.ii.518-521)