No story exists in a vacuum. There is, as they say, nothing new under the sun. But some stories draw a bit more heavily on predecessors than others. Meanwhile, many authors bite their nails while reading new deal announcements because they think, "OH NO THAT IS WHAT I'M WRITING!" Cassandra Clare sold the Infernal Devices books not longer before Magic Under Glass sold and I thought, "Oh noes! Clockwork Prince? My book has a clockwork prince in it!!!" It doesn't take much for us to freak out.
What about when the borrowing is conscious? What's the difference between a retelling, a reworking, an homage, or...PLAGIARISM!?
Ultimately? The author will intend one thing, the reader will get another. I've seen reviews about Magic Under Glass that felt it was just a flat-out rip-off of Jane Eyre, other reviews that appreciated the nod but noted that the book goes in a completely different direction. But I'm going to attempt some definitions.
A retelling sticks to the basic structure of the original story at heart. Retellings are usually of fairy tales, myths, or classics. If it is no longer under copyright, it's up for grabs. If character and setting is your strength as a writer and plot is not, then retellings might be a great option for you. The story is already there! The trouble, of course, is putting a new twist on it, like changing a character's gender, telling the story from an unusual POV (like the villain's perspective...perhaps we see they aren't as villainous as we thought), or picking a quirky setting.
A reworking, in my mind, is when you take a pre-existing story and start twisting it enough that it no longer resembles the original enough to be a straight-out retelling, but the reader can still recognize the source material in there somewhere.
An homage, or "nod" to a previous work, might be even farther from the original source. I also think it is different from a reworking in that you can nod to several things at once. It might not be terribly obvious except to readers who are big fans of the source material.
Still, the line between reworking and homage can be blurry indeed. I tend to feel that if your story BEGAN with the original material, it is a reworking. To me, Dark Metropolis is a reworking of the 1927 film Metropolis because it began with the premise of "What if the underground workers in Metropolis were dead?" Then I wondered what it would be like if I switched the genders of the characters in Metropolis. THEN things started getting off-track and less recognizable, but, it still began with Metropolis. Magic Under Glass, OTOH, came from the desire simply to write a book along the lines of classic novels about girls in reduced circumstances who fall in love in a house full of secrets, inspired by not just Jane Eyre, but A Little Princess, The Secret Garden, and Rebecca. So, to me, it is an homage.
Finally, we come to just plain ripping off someone else's work. This usually happens between two relatively modern works--if you write something about Lizzie Bennett, it's not longer a rip-off, it's acceptable fan fic, right? You can plagiarize anything--a character, a story, a phrase, even a style, although you can't be sued for borrowing a style!
The thing about ripping off stories is, it doesn't happen as much as readers seem to think it does. Strange coincidences happen between two books all the time. Apparently Tera Lynn Childs' mermaid books have a character named Dosinia and so does Between the Sea and Sky. It's the name of a mollusk, but I'm braced for someone to think I ripped it from Forgive My Fins. I promise you...I had nooo idea. Between the Sea and Sky was finished before Forgive My Fins came out, even though it's released much later. People seemed to come out of the woodwork to sue J. K. Rowling because they'd written a book about wizards, or had creatures named "Muggles" in their story, or whatever.
It goes without saying, obviously, published writers shouldn't plagiarize. Some writers avoid reading stories resembling their own while writing to avoid subconscious plagiarism. I, meanwhile, try to read everything that sounds like something I'm working on so that if I do find a similar element, I can change it. But no one can entirely defy the might of the collective unconscious!
If you're a beginning/intermediate writer not yet gunning for publication, however? I say, rip off characters, plot and style freely. Artists copy other artists, why shouldn't you? I was a shameless borrower in my youth, so my "original" stories often read like a fan-fic mashup with characters from a dozen different books or movies, perhaps thinly disguised by a name change. Stylewise, at different point in my life I tried to write like The Mists of Avalon, The Babysitter's Club, Francesca Lia Block, Marvel Comics, Piers Anthony, and L. M. Montgomery. Feel free to write fan fic, too, if that's your speed. My only advice for the young writer as far as borrowing goes is just to draw from incredibly disparate elements. That's how you'll end up with your own style. Look at all the writers who wrote as much like Tolkien as they could manage in the high fantasy genre for decades. Let's try and move away from that! If people praise my work for being original and creative now, trust me, it's because when I was about 13 I thought it would be a great idea to combine elements of The Nightmare Before Christmas, Seinfeld and Arthurian lore into one story...I still like to look for the quirky in my story choices, although I've gotten a bit wiser about it!