When three angels came to visit Avraham’s tent, they famously asked him, “Where (ayeh) is your wife Sarah?” (Genesis 18:9). After Adam ate from the Tree of Knowledge and hid, G-d rhetorically asked him, “Where are you (ayeka)?” (ibid. 3:9). After Kayin killed his brother, G-d asked him, “Where (ey) is your brother Hevel?” (ibid. 4:9). All three of these words share the same shoresh.
Two other words for where in Hebrew are “an” (I Samuel 10:14, Job 8:2) – with its derivatives “anah” (Biblical Hebrew) and “le’an” (Rabbinic Hebrew) – and “eifoh.”
Rabbi Shlomo Pappenheim of Breslau (1740-1814) writes that the root of “ey“/”ayeh” is aleph-yud. Another word derived from this root is “ee” (island). An island is surrounded by water on all sides; there are no landmarks one can use to find it. Since its exact location is hard to determine, the Hebrew word for island asks where it is.
Rabbi Shlomo Aharon Wertheimer (1866-1935) notes that “ey” sometimes serves to question “if” or “how” something actually exists, and can also mean “which.”
Rashi (to Job 38:4) explains that “eifoh” is a portmanteau of the words “ey” (which) and “poh” (here). The same is true of the Aramaic words for where (“heicha“/”heichan“), which are derived from the Aramaic words “hei” (which) and “ka“/”kan“ (here).
Rashi (to Genesis 27:33, 43:11), as elucidated by Rabbi Eliyahu Mizrachi (1455-1525), maintains that “eifoh“ can also mean “now” (Isaiah 22:1) or “what/who” (Judges 8:18). Radak, in Sefer HaShorashim, evidently follows this approach, as well. Others point out that in some cases, “eifo” is an interjection which serves as a general expression of confusion and astonishment and does not necessarily mean “where.”
(For a discussion of whether “eifoh“ with a hey and “eifoh” with an alef mean the same thing, see Rabbi Uriel Frank’s article in Kovetz HaMa’yan [Tevet 5770].)
Rabbi Wertheimer writes that “ayeh” is used when one has no inkling where something is, while “eifo” is used when one does have a general sense of where it is.
Rabbi Samson Raphael Hirsch’s great uncle, Rabbi Yehuda Leib Shapira-Frankfurter (1743-1826), writes in HaRechasim LeVikah that “eifoh” is used for run-of-the-mill “where is” questions while “ayeh” is used when someone searching for something is surprised that it is not in a particular place. In other words, “eifoh” means “Where is…?” and “ayeh” means “Why is… not here?” In the case of Adam hiding after his sin, G-d used a derivative of “ayeh” to rhetorically ask why Adam was not in his regular place.
Rabbi Yaakov Tzvi Mecklenburg (1785-1865) uses this basic approach to explain why the angels asked Avraham, “Where is (ayeh) your wife Sarah?” Since Avraham was quite weak after having had a bris, the angels expected Sarah to be present, setting the table. So they inquired, “Why is she not here, where we expected her to be?”
Rabbi Pappenheim writes that “ayeh“ and “eifoh“ focus on something’s current location, while “an“/”anah“/”le’an“ focus on something’s destination. The Hebrew word for boat is “aniah” because boat does not travel in a straight line. Since a boat’s final destination is not readily apparent by observing its route, one might ask about such a seafaring vessel, “Where is it going?”
Since time and space are interrelated (in reality and in the Hebrew language), it is quite understandable that “anah” can also mean until when (see Numbers 14:11).