Critics of the Bible love this supposed contradiction, for obvious reasons. After all, here we see the Bible contradicting itself in two verses which are ONE RIGHT AFTER THE OTHER! Obviously, the critic reasons, this means that the Bible-belt trailer park denizen with a fourth-grade education who wrote Proverbs was so ignorant as to not even notice that he had contradicted a verse which he had just written.
However, the claim which critics make concerning this "contradiction" only shows that the critics themselves are uneducated when it comes to Hebrew poetic construction. Hebrew poetry, unlike the large bulk of Western poetry, is not based off of grammatic rhythm (i.e. the various metres which centre about the way words rhyme). Rather, Hebrew poetry is parallelistic, and relies on rhythm of thought, not sound. There are many forms of parallelism presented in Hebrew poetry, but the one of interest to us today is "antithetic parallelism". This form of parallelism involves the presentation of a thought, followed in the second line by the presentation of a second thought which is related to the first, but is the negative or contrast to the first thought.
An example of this type of parallelism, also found in Proverbs, is Proverbs 6:20,
"My son, keep thy father's commandment, and forsake not the law of thy mother."
Two related ideas are presented, but the one is a positive command, while the other is a negative. Observe how this works in our disputed passage below:
"Answer not a fool, according to his folly, lest thou also be like unto him.
"Answer a fool according to his folly, lest he be wise in his own conceit."
We see that the two verses present related thoughts (answering a fool), but which are contrasted (one says to answer, the other to not answer). The basis of this contrast is the particular consequence for carrying out the action.
These passages are not contradictory, but rather they are complementary. They present two sides of the same issue, which is "how to deal with a fool". Proverbs 26:4 says that a fool should not be answered so as cause us to be like unto him, while Proverbs 26:5 says that a fool should be answered in such a way as to prevent him from being "wise in his own conceit." The one verse teaches against answering a fool in the same way that he, himself, presents his beliefs (e.g. pridefully, contentiously, etc.). The complementary verse then teaches that a fool SHOULD be answered, so that he does not falsely think his position to be sound, and grow conceited, because he has not been answered. Basically, two sides of the same coin are presented in these two verses.
Further, those who make this challenge (and ones like it) also forget that the Proverbs are very rarely set out as hard and fast commandments, but are rather presented as general guidelines which will be followed by the wise and ignored by the foolish (which DO give us an understanding of God's mind on any given matter). One of the overarching themes of Proverbs is that of using discretion in the gaining and use of knowledge. When we take these two bits of information into account, we can see the benefit of presenting this passage in the antithetical fashion. Proverbs 26:4-5 is providing for God's people a way in which they can rightly challenge the error propagated by fools while yet keeping themselves from entering into the same sort of foolish presentation themselves, and the antithetical presentation helps to bring this need for discretion to the forefront of the respondant's mind.
Hence, we should note that only a VERY superficial reading of these verses would actually cause one to think they contradicted, given the rather common device (especially in Proverbs and the Psalms) of Hebrew poetic parallelism. Of course, we should also note that this claim of contradiction is usually also made by sceptics who probably have never even cracked a Bible open, other than to superficially look at the "contradictions" which they find floating around on second-rate sceptic sites on the internet. Thus, this claim is based on sceptical ignorance, and is disproven by the poetic construction of the passage itself.