You know, every once in a while, I have some newbie asking me questions that make me distinctly nervous. Those questions center around how close to the mark they can push someone else's IP rights and hope not to get sued. Well, the gross answer is...how far do you want to, and how much toss-away money do you HAVE to fight a lawsuit, because what you suggest is placing you in territory to be sued!
Let me make it simple...as simple as IP really is...
You really have to be careful quoting someone else in a book you are selling for profit, whether you're quoting from another e-book, a print book or a song. Educational use...quoting in a (for instance) doctorate paper, with proper bibliography, is one thing, and even then, you have a fair use package of how MUCH you can quote from them, even with attribution. It's another to do it in a work you'll be paid for...that you intend to sell.
A prime example of this is the author of a series of textbooks that teach people comedy writing and performance. She is currently being sued for including portions of stand-up routines from shows like The Tonight Show in her books.
In the same way, people using as little as a single line of a song without permission have been sued by the rights owners, since it is nearly impossible to establish fair use with something so short. That is why I suggest using the song title and nothing more...or paraphrasing the song...or intimating what line you mean in a song, if you desperately need a popular song. If you don't, you might try getting permission for a lesser known song from the artist directly (which I've done personally) OR writing a song of your own.
Even the (rather spurious) case against Dan Brown and their shared publisher by the non-fiction writers he "borrowed" from says a lot. Using someone else's research as part of your plotline puts you in an actionable position.
The BEST thing to do is ask permission from the person who wrote the original, UNLESS it's public domain. Even then, be careful. For instance, The Wizard of Oz is public domain, which is why Wicked and Son of the Witch were possible, using the characters established by Baum in his Oz series. HOWEVER, the ORIGINAL Wizard of Oz has silver shoes in it. The ruby slippers are from the movie, which is NOT public domain, which is why Wicked uses multicolored gems on the shoes. Check your facts against the public domain original and don't make assumptions.
The one time this is tossed out is for parody, and even then, little details (like the name of the characters) are sometimes changed. For instance Joy Nash's Heroes, Inc. has parodies of superheroes, but their names are all changed slightly...like Clark Kendall instead of Clark Kent. Everyone knows WHO she means, but she's not using the character as written.
Another ism is the idea of cultural icon. You can call someone "a regular Superman" in your book, but if you USE the character of Superman, which is not public domain, in your book AS A CHARACTER, you will be sued for it.
e-Book or print book... Regardless of which you're doing (or both), you should have proper permissions, or you risk lawsuit. It's still IP law, and if you are playing with rights to e-books, you're also playing with electronic media laws, so don't think it's any better there. IP rights are IP rights, no matter what medium the original is in...or what medium your product is in.
You cannot copyright IDEAS. You copyright creative expression OF those ideas. You can trademark certain terms and names. There are some things you can protect and some you can't.
For instance... I came up with the idea of my vampires wearing the illusion of clothing BEFORE Christine Feehan added that OPTION for her Carpathians. Before that, hers always wove what they needed from elements in the air. I probably COULD try to sue her (though I seriously doubt that Christine is stealing from me...grinning...lovely lady that she is), but I'd also probably lose in court, because with the powers of vampires, it's easy to come up with the same "what ifs" along the way.
And, people often play "what if" to get new story ideas. How many worlds of vampyr type creatures hunting vampires are there out there? I have one. Mine wasn't the first. Neither was Sherrilyn Kenyon's. Neither was Christine Feehan's...not that any of these are particularly like the other. Blade wasn't even the first. One of the earlier ones would be Vampire Hunter D, for instance. To be honest, my vampires are a LOT more like Vampire Hunter D than my vampyr are. So, no...getting a story idea from playing "what if" with an existing idea isn't a problem.
HOWEVER, I'll be blunt here. If you read a scene and say, "That's cool. I think I'll do something like it." If you then rewrite that scene to your characters and your needs, keeping the same sort of interaction and movements...maybe similar words, you will get sued if the original author finds out, and they WILL have a case against you. There is a MAJOR difference between gross storyline ideas and scene stealing.