וַיִּתְרֹצְצוּ הַבָּנִים, בְּקִרְבָּהּ, וַתֹּאמֶר אִם-כֵּן, לָמָּה זֶּה אָנֹכִי; וַתֵּלֶךְ, לִדְרֹשׁ אֶת-ה
"And the children struggled together within her; and she said: 'If it be so, wherefore do I live?' And she went to inquire of the LORD."
The meaning of לִדְרֹשׁ אֶת-ה is a matter of dispute. The simplest meaning, if we knew no better, was that Rivka wished to ask Hashem a question, asked directly, and Hashem responded. The next pasuk states:
וַיֹּאמֶר ה לָהּ, שְׁנֵי גֹיִים בְּבִטְנֵךְ, וּשְׁנֵי לְאֻמִּים, מִמֵּעַיִךְ יִפָּרֵדוּ; וּלְאֹם מִלְאֹם יֶאֱמָץ, וְרַב יַעֲבֹד צָעִיר
"And the LORD said unto her: Two nations are in thy womb, and two peoples shall be separated from thy bowels; and the one people shall be stronger than the other people; and the elder shall serve the younger."
Thus Hashem directly answers her, so it seems that she directly asked Hashem a question.
Now, one does not merely ask Hashem a question and get an answer. There are two known ways man converses with Hashem - prayer and prophecy. Again the simplest assumption was that she sought to converse with Hashem in a prophetic manner and received prophecy. Perhaps וַתֵּלֶךְ לִדְרֹשׁ אֶת-ה means that she used some mantic method to try to induce prophecy.
Why is this simple reading not given by the standard commentators, even Ibn Ezra, known for giving pshat? Instead they explain it refers to prayer, or else prophecy via an intermediary, such as Avraham or (with a midrash) Shem.
The answer is that if we look through Tanach at how the phrase לִדְרֹשׁ אֶת-ה is used in terms of prophecy, it always means via an intermediary. That is, the person who is Doresh Hashem goes to a prophet to inquire of Hashem, and receives a response from the prophet.
For example, Shaul goes to inquire after his father's donkeys from the seer, the Roeh. In a parenthetical remark in Shmuel I 9:9, the pasuk states:
לְפָנִים בְּיִשְׂרָאֵל, כֹּה-אָמַר הָאִישׁ בְּלֶכְתּוֹ לִדְרוֹשׁ אֱלֹהִים, לְכוּ וְנֵלְכָה, עַד-הָרֹאֶה: כִּי לַנָּבִיא הַיּוֹם, יִקָּרֵא לְפָנִים הָרֹאֶה
"Beforetime in Israel, when a man went to inquire of God, thus he said: 'Come and let us go to the seer'; for he that is now called a prophet was beforetime called a seer."
Here בְּלֶכְתּוֹ לִדְרוֹשׁ אֱלֹהִים parallels in each word וַתֵּלֶךְ לִדְרֹשׁ אֶת-ה, so it stands to reason the act is the same.
Another example is in Kings I 22:8:
וַיֹּאמֶר מֶלֶךְ-יִשְׂרָאֵל אֶל-יְהוֹשָׁפָט עוֹד אִישׁ-אֶחָד לִדְרֹשׁ אֶת-ה מֵאֹתוֹ וַאֲנִי שְׂנֵאתִיו, כִּי לֹא-יִתְנַבֵּא עָלַי טוֹב כִּי אִם-רָע--מִיכָיְהוּ, בֶּן-יִמְלָה; וַיֹּאמֶר, יְהוֹשָׁפָט, אַל-יֹאמַר הַמֶּלֶךְ, כֵּן.
"And the king of Israel said unto Jehoshaphat: 'There is yet one man by whom we may inquire of the LORD, Micaiah the son of Imlah; but I hate him; for he doth not prophesy good concerning me, but evil.' And Jehoshaphat said: 'Let not the king say so.'"
Here they are clearly going to inquire of Hashem, לִדְרֹשׁ אֶת-ה via an intermediary, a prophet, and the words are the same. Such examples abound. Thus what seemed like simplest pshat was really a bad reading based on ignorance of the meaning of the Biblical phrase.
The simplest meaning then should be that she inquired about her situation from Hashem via a prophet, and the prophet answered. Such a reading is not, say, a misogynistic plot to remove prophetic roles from women.
On the other hand, we have psukim which use דרש to mean prayer. Consider Tehillim 34:5
דָּרַשְׁתִּי אֶת-ה וְעָנָנִי; וּמִכָּל-מְגוּרוֹתַי הִצִּילָנִי
"I sought the LORD, and He answered me, and delivered me from all my fears."
and Amos 5:4
כִּי כֹה אָמַר ה, לְבֵית יִשְׂרָאֵל: דִּרְשׁוּנִי, וִחְיוּ.
"For thus saith the LORD unto the house of Israel: Seek ye Me, and live; "
So, the word דרש can mean either prayer or prophecy. The purpose of the former is to seek Hashem's intervention. The purpose of the latter is to seek Hashem's intention.
The Targumim are divided in terms of their explanation of the phrase. Targum Onkelos says, "to seek Ulpan from before Hashem." Ulpan is learning, knowledge, and thus understands Rivka's actions to be a quest for information, that is via prophecy, which Hashem grants, and informs (possibly via a prophet) her of what will be.
Targum Yonatan and Targum Yerushalmi explains that she went to the bet midrash of Shem Rabba to request Rachamim, mercy. Thus he sees it as a request for Hashem's intervention, that is, a prayer. It is very strange that Yonatan refers to the medrash of going to the bet midrash of Shem if he takes her דרש as prayer. Why not pray directly. Why go to the bet midrash of Shem. Perhaps he is assuming, based on the midrash, that Rivka does not receive direct prophecy, so in order to hear Hasehm's reply, she needs to go to Shem, but she still went to pray. It is indeed curious, and we may come back to this later.
Rashi has two comments. First, he explains לִדְרֹשׁ אֶת-ה to mean she went to the bet midrash of Shem. Secondly he explains לִדְרֹשׁ אֶת-ה to mean that she went to find out what would happen in the end, that is, to seek information, Onkelos's Ulpan, so she went to seek prophecy. It seems that Rashi cites two separate midrashim (and I wish I had Shlomo Gelbardt's Lifshuto Shel Rashi on hand!), first taking the hyper-literal rendition of לדרש to mean the bet midrash, and who had a bet midrash but Shem. Secondly, he explains, more on a pshat level, that לדרש את ה means that she went to find out information via prophetic means. The blending of the two is that she went to the bet medrash of Shem to seek information via prophecy. [I need to find the original midrash]
Ramban takes issue with the latter point of Rashi, that לדרש means seeking knowledge. Ramban says that דרישה in the context of Hashem he has found only to mean prayer, and cites as examples the two examples I cited above. This seems strange given that there are many instances it means seeking information from a prophet, some of which I have given above. At any rate, the dispute between Rashi and Ramban parallels that of Onkelos vs Tg Yonatan and Tg Yerushalmi.
A further interesting issue, which hooks into the above, is the source for Rivka going to the Yeshiva of Shem.
Siftei Chachamim explains Rashi's statement that she went to the Yeshiva of Shem that the pasuk says וַתֵּלֶךְ לִדְרֹשׁ instead of just ותדרש, for Hashem is everywhere, His Glory fills the entire world, so why would she need to go somewhere? This implies she went somewhere to ask her question, so she must have gone to the bet midrash of Shem. She would not go to the bet midrash of Ever, because Shem was Ever's grandfather and was still alive. Further, she did not go to Avraham since Hashem arranged it this way so that Avraham would not get aggravated about it.
Siftei Chachamim seems to be taking the "What Was Bothering Rashi" approach that the word וַתֵּלֶךְ is extra and unnecessary, so it shows she went somewhere to ask. Perhaps (and it seems to me to be so from his language) he also takes it to mean that this is the source that she asked someone instead of having her own prophecy or praying there to Hashem to tell her or intercede. In this case I don't think we need to resort to midrash, or questions of the sort raised by Siftei Chachamim, for as I pointed out earlier, the phrase when it doesn't mean prayer means to seek prophecy from Hashem via an intermediary, a prophet.
Baal HaTurim, always entertaining, notes that לִדְרֹשׁ is the same gematria as Shem ben Noach.
The explanation I found the most beautiful (though probably untrue) is given by Perush Yonatan, a commentary on Tg Yonatan, which I will expand on somewhat. On Pesachim 22b, the Tanna Shimon the Amsoni interpreted each את (which literally means "with" but in Hebrew often simply denotes the object as distinguished from the subject) in the Torah to include something (לרבות). However, when he got to Devarim 10:20: אֶת-ה אֱלֹהֶיךָ תִּירָא, he abandoned the project, since what nothing could be equated to Hashem that we should fear. He said, just as I received reward on the drisha, so shall I receive reward on the prisha (distancing myself from this drash). Rabbi Akiva, though, took it to include respect for תלמדי חכמים.
On the basis of this, the אֶת of וַתֵּלֶךְ לִדְרֹשׁ אֶת-ה includes and refers to Torah Scholars, and the Torah Scholars in those days were learning in the bet midrash of Shem.
Nobody explicitly states it but I think it is clear that וַתֵּלֶךְ לִדְרֹשׁ אֶת-ה is midrashicly taken to mean that she went (וַתֵּלֶךְ ) to the bet midrash (לִדְרֹשׁ ). What bet midrash is there except that of Shem and that of Ever? I think furthermore that the phrase is midrashicly interpreted twice in succession, or else once in pshat form. So she goes to the bet medrash of Shem, says the medrash. Why? Well, looking at the same words again, וַתֵּלֶךְ לִדְרֹשׁ אֶת-ה, which depending at which other psukim you look at in Tanach, means to pray or to seek knowledge. Rashi differs from the Targumim Yonatan and Yerushalmi in the second meaning of לִדְרֹשׁ (prophecy vs prayer) but not in the first, that she went to the place of Shem.
Incidentally, the Targumim Yonatan and Yerushalmi call Shem "שם רבא." Does this mean "the greater." If so, it may parallel Siftei Chachamim's explanation of why she went to Shem's bet midrash and not Ever's, since he was the elder.
Finally, one explanation running through my head almost certainly incorrect is that in וַתֵּלֶךְ לִדְרֹשׁ אֶת-ה ,the midrash takes the Hashem's name not as YKVK and not as Shem Adnus ("Ado...") but as HaShem, which could be read as the Shem, that she went (וַתֵּלֶךְ ) to the bet medrash (לִדְרֹשׁ ) of Shem (אֶת-ה).