The word midrash refers to "searching out" the meaning of, or interpreting, the words of the Torah. Midrash tells new stories, answers new questions and forges connections between new Jewish realities and the eternal, unchanging biblical text.
When this searching centers on ideas, values, or the story and characters of the Torah, it is known as midrash aggadah. When the focus is on Jewish law and practices, it is called midrash halakhah. The latter term is also used to refer to a set of works from the talmudic period that are largely made up of legal interpretations ofthe books of Exodus, Leviticus, Numbers, and Deuteronomy.
The text of the Torah is often general or ambiguous even when presenting laws. Midrash halakhah attempts to clarify, specify, or extend a law beyond its obvious reference points.
For example, Deuteronomy 6:6-9 teaches:
"These words that I command you today shall be on your heart. You shall teach them repeatedly to your children, and speak of them when you sit in your home, when you go on your way, when you lie down and when you get up. You shall bind them for a sign on your hand and they shall be frontlets between your eyes; you shall write them on the doorposts of your house on your [city] gates."
"These words" could refer to the verses at hand, the longer speech Moses is giving, or even the whole of Torah. The ancient rabbis interpreted the phrase as referring to verses from this and two other biblical chapters that have come to be known as the prayer Shema. They debated whether "when you lie down and when you get up" refers to the physical position one should be in to say Shema, or the specific times of day for its recitation (evening and morning). They derived other practices--the tefillin boxes worn on the arm and forehead, the mezuzah container affixed to doorposts throughout a home, each containing the words of the Shema--from the same Deuteronomy passage.