Midrash--searching and probing the text of the Tanakh (Hebrew Bible)--divides into two categories. Some midrashic writing deals with practical matters of Jewish law and behavior (halakhah), and is known as midrash halakhah. Most midrash explores ethical ideas, biblical characters, or narrative moments, and is known as midrash aggadah.(Aggadah literally means "telling” or story.) When Jews use the colloquial "it says in the midrash," they are usually referring to teachings of midrash aggadah, generally those found in a corpus of classical Jewish texts compiled between about 200 and 1000 C.E.
Midrash aggadah can take any biblical word or verse as a starting point, but there is no one standardized method of interpretation. Indeed, some scholars define midrash simply as any Jewish statement with a reference to a specific biblical verse or verses.
For the classical rabbis, the guiding assumption was that Torah, and Tanakh more generally, were true not only for their own time, but also for all time. Midrash sometimes involved drawing out biblical paradigms or insights that could apply to contemporary reality, and was a complex interplay of reverence for the text and theological creativity.
For rabbis both steeped in Tanakh and absorbed by the Jewish questions of their time, there was no clear line between explaining the received Torah and generating new ideas. Tanakh was their language for coming to grips with life in exile, under foreign rule. Even the rabbis' most audacious statements about God and Jewish history were kept within normative bounds by linking them to biblical verses.
Midrash aggadah is found in many places throughout the two Talmuds and in midrashic collections. Midrash Rabbah, the "Great Midrash," is the name given to a set of collections linked to each of the five books of the Torah and the five scrolls of the Ketuvim (Writings, the third section of the Tanakh) read on holidays.
Some of these early works read like verse-by-verse commentaries. Others may have originated in sermons linked to the weekly Shabbat Torah readings. The latter frequently take a form known as petichta (Aramaic for "opening"), in which a verse from the Prophets or the Writings is linked through a train of thoughts and associations with the opening verse of the Torah reading.