Riker is rehearsing a play with Data in which he plays a man (perhaps) falsely accused of murder, locked in an asylum with a doctor who seems intent on convincing him he is guilty and insane.
Or perhaps he is really a madman who committed a murder, held in an asylum until he can overcome his delusions of being a starfleet officer, and stand trial for his crime–or suffer a (space!) lobotomy.
In fact, both settings are imaginary–he has been captured and is hooked up to some mind probe or other, and his brain is inventing things as a sort of defense mechanism. He convinces himself nothing is real, wakes up, and calls the Enterprise to be beamed up pronto.
It's a generally entertaining if unoriginal plot, but the episode fails to convince us that Riker is right to believe the scenes on the Enterprise are deulsions while the asylum is real. It makes sense for him to believe it. He says the Enterprise bits fade away from him, but the asylum always seems absolutely real, so it's sensible, while he's in the asylum, to think it might be true–especially as he has forgotten even his name. But to convince the audience of that, when we've spent the last hundred and some episodes with him on the Enterprise and remember it perfectly well is another matter. I can't think of any way they could have pulled it off, but without us questioning at least a little what is real, there's not much meaningful suspense there.
The only bit that really got me was at the end, Picard tells Riker that they can "talk some more tomorrow", just as Syrus kept telling him that they'd continue talking later (and a few other times during the episode, scenes ended by putting things off until tomorrow)–it made me question, for a moment, whether what we were seeing now was reality or just more illusion. I imagine it must have been deliberate, but nothing is made of it, and the episode ends with a quick closing scene of Riker taking down the set from the play (which looked like the cell from his delusion).
The resolution is really a big letdown–Riker just wakes up, grabs his effects, and makes a phone call, off he goes. Just why did they leave a weapon and communicator a few feet from the prisoner? Incredible incompetence.