This question specifically asks about "canonicity in sci-fi and fantasy." I'm not quite sure why it does this. Although the word canon seems to be one that is used mostly in Science Fiction and Fantasy fanbases, the underlying concept -- what supplemental works (author interviews, sequels, etc. etc.) should we consider when trying to learn more about a specific story -- is one that people who study literature have debated for quite some time.
In this answer I'm going to give a brief introduction to some of the answers to this question. There isn't a clear answer to this question, and this question has important philosophical implications for how we understand art.
Authorial Intent
One way of answering this question is that whatever the author says about a text is true. They, after all, wrote the text, so anything that they say about the text should be true.
Unfortunately, it's actually quite common for authors to misremember or not understand the things that they write. Here's a really funny example of this on reddit. This, among other reasons, has caused many people to question the value of relying on the word of god.
The Text Itself
Another approach is to only focus on what is said in the text itself. The definition of text needs to be clarified. I would define "text" as something marketed by an author as a single unit. To use The Lord of the Rings series as an example: I would define The Fellowship of the Ring, The Two Towers, and The Return of the King as they are marketed under one label and are considered "one project" by the author. I would consider books like The Hobbit and The Silmarillion as separate entities.
What are the reasons for this method? Philosophically, it reflects the idea that a story has some sort of structure that separates it from things like what the author thinks they've written. Practically, it reduces (eliminates?) inconsistencies: to continue the example of Tolkien: Middle-earth changed dramatically from The Hobbit to The Lord of the Rings to The Silmarillion, but a single text such as The Lord of the Rings is (supposedly) a snapshot of Middle-earth at a specific point in the development of Middle-earth, and will thus have less contradictions.
(There is always the possible that an author will unintentionally introduce contradictions into a text, or change details as they progress through a series and come up with new ideas. There also is the possibility that an author will intentionally introduce contradictions, which is something I will discuss later in this answer.)
The downside of this is that there's a lot of information contained outside the text that we would like to be able to analyze.
Hierarchies of Canonicity
The traditional fix to this problem is to create a hierarchy of various supplemental sources, e.g. check The Lord of the Rings first, and if it's not answered there, check The Silmarillion, and then check The Hobbit.
This doesn't seem to me like a very good method. For one thing, how should this hierarchy be determined? Why is The Hobbit a less important source than The Silmarillion? The answer is: no reason whatsoever. The only difference is that The Silmarillion was written later, and thus is a reflection of Middle-earth at a different state in its composition.
There are numerous reasons why scholars (i.e. professionals) of literature don't waste their time trying to create a hierarchy of canonicity.
Textual Archaeology
To continue the example of The Lord of the Rings: Tolkien modified and developed his ideas about Middle-earth throughout his life. To simplify things considerably, The Hobbit can be considered an early draft of The Lord of the Rings.
One approach to canonicity is to consider how a story is written, how it is revised and polished into it's published form. This approach can also consider how an author's vision of a story changes after a story is published. I like this method because it resolves questions of canonicity by considering different texts as revisions of an author's ideas. I also like this method because the revision process can be an important source of information about a text.
Another approach is to consider a text an extension of an authors biography. For example, it's clear that real world events inspired a lot of events in Tolkien's fictional writing. And even if we can't point to a specific real-life event that inspired a fictional event, it's also obvious that, for example, Tolkien's ideas about, say, environmentalism have to come from somewhere. Under this approach to canon, an author's political philosophy is fair game, because that will influence the text.
Considering Works not Written by the Author
There are two approaches to whether a movie adaptation of a novel is canon. The first holds that the movie and the novel are completely different entities because they are written by different authors. The second is that because the movie is clearly based off of the novel (and is usually endorsed by the author, by virtue of the author signing the contract), a movie adaptation should be considered canon.
I would like propose a third perspective. Reader Response criticism is a way of looking at texts that focuses on how the audience responds to a text. A movie adaptation can, and should, be considered a interpretation of the original text, albeit one that costs millions of dollars to produce. The question thus becomes why does the "author" of a movie make the changes they make, and why do they interpret the story in a specific way.
(These points apply to other adaptations, such as comic books, equally well.)
A note on contradictions
From what I've read of SFF.SE, the point of concepts like canon is to avoid contradictions, i.e. an extended world book in Star Wars saying something that contradicts something said in the original trilogy.
I would question the importance of avoiding contradictions. Contradictions will always occur: authors will forget minor details, or an author will dislike a detail in a previous book and change it, or an author will intentionally introduce contradictions to confuse their readers.
What's more important, in my opinion, is to ask why contradictions occur, and to try to answer that question as best as you can.