If you, say, wrote a remake of Casablanca, followed the original closely but with alterations, stuck with all the same characters, and called it 'Casablanca', you'd probably come up against a wall of lawyers at some point. But if you took the basic story structure of Casablanca, twisted and turned it, changed all the characters, set it in the future somewhere not related to Morocco, and made the protagonist a female instead of a male...
...you'd probably still run up against a wall of lawyers because you would have written a remake of 'Barb Wire'.
but you get my point. You can steal - er - pay homage - to a degree, but you can't blatantly copy without rights issues