This is not always the case of quotations within the narrative. It is obvious when we read the quotation attributed to the serpent in Genesis 3:4 "You will not surely die" that it contradicts what God said in Genesis 2:17, but we understand this contradiction because we know what the serpent said is a lie. It may not be as obvious, why there are contradictory stories of the death of King Saul in the 31st chapter of 1 Samuel and the 1st chapter of 2 Samuel. The contradiction is understood when we realize that the story in 1 Samuel 31 is that of the biblical narrative, while the story in 2 Samuel 1 is that of a "man from Saul's camp" who hoped to win a reward from David by claiming to be the man who killed David's enemy. .
In general, you may approach the various biblical genres as you would the same genres found in literature. Poetry contains much symbolism and wordplay. Words and phrases are chosen for their evocative power in presenting the message. Parables are not intended as historically accurate retelling of events. They are presenting abstract spiritual ideas through concrete common events, places, and kinds of people. Laws may be universal or specific to particular times and places. Even if universal, their application may call for exceptions or for prioritizing one law over another. However, we should always avoid "over-spiritualizing" or discounting any Scripture as "merely allegorical." All scripture should be taken literally unless the context clearly indicates otherwise.
Historical Context.
Historical context includes the occasion and purpose for writing the book and the social, cultural and political background and geography of the human author and original audience. Understanding the historical context aids in understanding the nature, force and content of the message. Scripture cannot mean now what it never meant when it was written.
Interpretation is demanded because of the "tension" between the Bible's eternal relevance and its historical setting.