Writers of fan fiction from time to time get cease and desist letters from studio in-house lawyers demanding that they take down their work. While many of the original creators don't pursue the makers of fan fiction, some do, since more often than not fan fictions are blatant copyright violations. Occasionally, fan fiction writers will produce parodies, but most fan fictions are derivative works that attempt to continue or build upon the original work.
Copyright law generally protects the creator of a work of fiction from someone else coming along and stealing not just their exact words, but also their characters, settings, storylines, and even fictional space languages. However, many fans get so engrossed in particular works that they are compelled to create continuations or variations on their favorite stories.