I've thought about writing some fanfic for a while now, but haven't gotten around to it. My ideas are there but aren't developed enough yet and I don't like doing things, particularly such as this, in half-measures.
Having read a little only, I'm not an authority by any stretch, but what I have read gives what I imagine is the same impression most people would get from fanfic, in that it is quite a mixed bag. As it's fans usually exploring a particular idea the variables that ultimately reflect the quality of their writing are many.
First, do they try to stay true to voice and characters of the original author/creator, or do they blaze their own trail? Both are challenging and have great pitfalls. When trying to stay true, it is very hard for a fan to capture the tone and style well, let alone match the writing quality of a paid author, particularly when they are the original visionary. When carving their own path, it's easy to fall short also because it either deviates too far from the original lore/canon and becomes unbelievable or is simply not a good direction. Because there's no financial risk/incentive or backup editing/quality control fans just write and may not give it any polish.
Further to the writer's voice, there is their innate creativity and writing ability, combined with the ability to write something well paced, engaging with vivid imagery and good use of language. The most common failing in this regard is that fan's write what they want to write, what they want to see happen. A good piece of writing however is not what the writer wants to write but what they want the audience to read. There is a crucial distinction between the two. As with film-making, the foremost thought in the director or writer's minds must be what the audience will see and take from the work, what emotions and feelings will they experience, what imagery will they see. The writing has to evoke the thoughts/emotions in the audience, not simply state what happens. F.ex:
"Suddenly the door opened, revealing a dark room beyond."
"The door opened with a frightening suddenness and stopped just as suddenly with a loud bang that reverberated through the cavernous room beyond which was dark, chill and eerie".
The first sentence is what the writer imagines. The second however paints a picture for the reader, engaging two of their senses and adding in the emotions of the character.
Lastly, ideas. Some are great, irrespective of whether they stick to the canon or not. Some in fact are great because they do not. Some however are frankly silly and uninteresting even as a concept and make for uninteresting reading, even if well written.
Combine all of the above and you find the mixed bag I initially described. YOu can find great writers with dumb ideas, rubbish writers with great ideas, average writers with good ideas but who cannot capture the essence of the world/characters, great writers with great ideas but who fail to capture the audience, etc.
A while ago, I read a He-Man fanfic (more than one, truth be told but one in particular), based on the 80s cartoons I grew up with. It explored the idea that Teela, a main "goodie" in the show discovered He-Man's true identity, that the greatest hero was in fact the alter ego of the boy she'd always considered a coward. It explored her conflicts with trying to resolve the revelation in her mind, the "unspoken", hinted at sexual tension, her own origins and destiny, her place in the "Masters" and more. It was a break from the canon but stuck close to the original characters (ie. motives were believable), well written but lacked proper pace and had obvious issues. Some bits were great and believable, others were not. A better writer would have fixed those bits.