David Guttmann of Believing is Knowing has posted an interesting discussion of the nature of midrash from the Rambam's perspective in his post: The Relationship Between Midrashic Exegesis and the Written Text. Here's an interesting quote by the Rambam:
As regards the four species [the branches of the palm tree, the citron, the myrtle, and the willows of the brook], our Sages gave a reason for their use by way of Midrashim, the method of which is well known to those who understand their discourse. They use the text of the Bible only as a kind of poetical language [for their own ideas], and do not intend thereby to give an interpretation of the text. Accordingly, with regard to the Midrashim, people are divided into two classes. For some think that, the Midrash contains the real explanation of the text, whilst others, finding that it cannot be reconciled with the words quoted, reject and ridicule it. The former struggle and fight to prove and to confirm such interpretations according to their opinion, and to keep them as the real meaning of the text; they consider them in the same light as traditional laws.Check out the whole thing.