Though I've always known it to be spelled as 'ay', it'll do, anyhoo.
This line comes from Shakespeare's tragedy "Hamlet", during what is probably one of the most famous (and most quoted)soliliquies of any written work to date.
Though original script calls for simply 'a room in the castle', several high-profile modern renditions have had it happen in the family crypt, amongst the bones of the dead royalty of Elsinore.
The phrase in question appears on line 71 of Act 3, scene one, the complete thought being "To die, to sleep; To sleep: perchance to dream: ay, there's the rub;" and is spoken, of course, by the crown prince Hamlet himself.
Though it seems to hold some cryptic meaning, it doesn't really. According the the dictionary, the word "rub" simply means, besides the obvious 'to smear', to be an obstacle or an impediment. So this sentence could be done, in 'modern' English, as "That's the problem".