How can one avoid misinterpreting a literary text, especially when it is ambiguous?
In addition to the cogent points made, one way to avoid misinterpretation of literary works is through the acquisition of knowledge of the author of the work as well as the literary movement under which this author is categorized. While there are arguments that works can be interpreted only their own merits, a familiarity with their authors certainly offers insights into perception of theme and recurring motifs and techniques. For instance, Ernest Hemingway's nihilism clearly comes through many of his works. And, a awareness of his technique called "the iceberg effect" leads a reader to look for symbolic meaning in his narratives.
Likewise, an understanding of the historical period and literary movement in which an author writes is definitely advantageous to sounder interpretation of a work. Charles Dickens's novel are clearly social criticism of his Victorian society. And, certainly a comprehension of the elements of Naturalism assists greatly in the understanding of the works of Stephen Crane such as Maggie: A Girl of the Streets or The Red Badge of Courage. Without doubt, a knowledge of Existentialism is paramount to interpreting the writings of Jean-Paul Sartre and Albert Camus.
There are a number of issues to be considered in a response to this question. Firstly, one of the joys of literary interpretation is that any text can be open to any number of views, and arguably our understanding and appreciation of literature only grows as a result of the various different views that we form as a result of the act of interpretation. Therefore, as I often tell my students, you can pretty much argue anything you want--as long as you can back it up from the text.
This goes to the second point of my answer. I believe that you have to be able to support your interpretation, however weird and bizarre it may be, with robust evidence from the text itself or from other sources. You can't just take a look at a text and argue that it is actually all about the environment or homosexuality (for example) without proof to back up your findings.
So, on the one hand, literature is a discipline that lends itself to very novel and unique views of one text. However, on the other hand, such views should be supported rigorously and robustly with evidence.
^^what mwestwood said.
In my opinion, the only "misinterpretation" of a literary text is one without ample textual support. I think all literary texts are ambiguous to some extent, and depending on which school of criticism you're practicing (formalist, feminist, cultural, psychological, etc.), you might arrive at a different interpretation than your peers. To me, it's all about supporting your viewpoints with rigorous and well-cited arguments.
Just my 2c :)