The Torah tells us that Yitzchak Avinu, just prior to meeting Rivkah, had gone out to meditate in the field לפנות ערב, towards evening (בראשית כ"ד:ס"ג). The Gemara in Berachos (דף כ"ו:) explains that this meditation was a form of Tefillah, and thus derives from here that it was Yitzchak Avinu who instituted the afternoon prayer, Tefillas Minchah. The Gemara earlier in Berachos (דף ו:) advises people to be extremely careful regarding Tefillas Minchah, implying that since Minchah was the specific Tefillah of Eliyahu HaNovi which was answered by Hashem (עיין מלכים א' י"ח:ל"ו-ל"ט) the time of day when one davens Minchah is an especially propitious time to have one's own Tefillos answered. This view is codified by the Tur (אורח חיים סימן רל"ב) who explains that this is the case because unlike Shacharis and Maariv, which can be recited at the beginning and at the end of one's day, respectively, davening Minchah requires an interruption in the middle of one's day, when one is busy and involved with one's own activities, and one who is able to pull himself away from his work in order to daven Minchah is thus greatly rewarded.
In analyzing why this Tefillah is called "Minchah," Tosafos in Pesachim (דף ק"ז. בד"ה סמוך) suggests that although certain Korbanos called Minchah offerings, consisting of flour and oil, were brought in the morning (עיין ויקרא ו:י"ג, במדבר כ"ח:ד'-ה'), a Minchah offering was brought in the afternoon as well (עיין במדבר שם פסוק ח'), and since Eliyahu's Tefillah was answered at the time when that afternoon Minchah was offered, as noted above, that time is considered a שעת רצון, a favorable hour for Tefillah, and the entire Tefillah is thus called "Minchah." The Avudraham (תפלת מנחה, עמוד קל"ב) suggests a different reason for the name "Minchah," connecting it to a comment found in Targum Onkelos (לבראשית ג':ח') that implies that the term refers to the tenth hour of the day (עיין בגמ' סנהדרין דף ל"ח:), which apparently is the time when people generally recite this Tefillah. The Aruch HaShulchan (או"ח שם סעיף א') notes that the word "Minchah" means a gift, and he explains why this Tefillah is like a gift, while the Torah Temimah, commenting on the Posuk in our Parsha (שם כ"ד:ס"ג, אות ל"ו), suggests that the term relates to the lowering of the sun in the sky.
Although the Posuk in our Parsha (שם) uses the word "ערב," which is usually translated as "evening," as presented above, to identify the time of this Tefillah, the Ramban, commenting on a Posuk later in the Torah (שמות י"ב:ו'),notes that the word can in fact have different meanings, focusing on different times of the day. The first Gemara in Berachos cited above (דף כ"ו:) thus makes reference to two Minchah periods, namely, Minchah Gedolah, the long Minchah period, which begins after 6 1/2 hours of the day have passed, and Minchah Ketanah, the short Minchah period, which begins after 9 1/2 hours of the day have passed. Rashi (שם בד"ה מנחה גדולה) first explains that the former time was the earliest moment that the afternoon Korban could be brought; he then explains (שם בד"ה מנחה קטנה) that the latter time was the moment when the afternoon Korban generally was actually brought, as stated by the Mishnah in Pesachim (דף נ"ח.), although the Gemara (שם) adds that there were occasions when it was indeed brought at the earlier time.
It must be noted that when a Halachic discussion focuses on "hours of the day," the reference is not to the units of time commonly called hours, which are 60 minutes long, but to Halachic units called שעות זמניות, variable hours, the length of which depend on the amount of daylight time in a particular 24 hour period; each such Halachic unit is 1/12 of the total daylight time, and will thus vary from winter, when there is less total daylight time so that each unit will be shorter, to summer, when there is more total daylight time so that each unit will be longer. This idea is expressed clearly by the Rambam, in his Peirush HaMishnayos on Berachos (פרק א' משנה ב'), as well as in a Teshuvah (שו"ת הרמב"ם, הוצאת פאר הדור סימן מ"ד, הוצאת בלאו חלק א' סימן קל"ד), and is cited by the Beis Yosef in his commentary on the Tur (או"ח סימן נ"ח בד"ה כתב הרמב"ם). Although the Rosh (תוס' הרא"ש לברכות דף ג: בד"ה כיון) seems to disagree, this position is accepted by the majority of the Poskim, and is implied by the words of the Shulchan Aruch (באו"ח שם סעיף א', ועיין שם בט"ז ס"ק א' ובמשנ"ב ס"ק ד' ובכף החיים אות ג', ובאו"ח סימן פ"ט סעיף א', ועיין שם במג"א ס"ק ד' ובבאר היטב ס"ק ג' ובמשנ"ב ס"ק ה') and is stated clearly by the Ramo (שם סימן רל"ג סעיף א', ועיין שם במג"א ס"ק ד' ובבאר היטב ס"ק ג' ובמשנ"ב ס"ק ד'), among others.
It must also be noted that there is a major dispute as to how to determine the total amount of daylight time in a given day, revolving around whether to measure from dawn until nightfall or from sunrise until sunset. The former opinion is popularly identified as that of the Magen Avraham (או"ח סימן נ"ח ס"ק א'), although others, including the Terumas HaDeshen שו"ת( תרומת הדשן סימן א'), the Pri Chodosh (שם סימן תמ"ג סוף ס"ק א'), and the Chayei Adam (כלל כ"א סעיף ג'), hold that way as well; the latter opinion is popularly identified as that of the Vilna Gaon (ביאור הגר"א לסימן תנ"ט סעיף ב' שם בד"ה ושיעור), although others, including the Rambam, as interpreted by the Tosafos Yom Tov, both in his commentary on the Mishnah in Pesachim (פרק ג' משנה ב' בד"ה אם) and in his commentary on the Rosh in Berachos (במעדני יו"ט לפרק א' סימן י' באות ט', ובדברי חמודות לפרק ד' באות כ"ה), and the Shulchan Aruch HaRav (או"ח סימן תמ"ג סעיף ד'), and the Aruch HaShulchan (שם סימן נ"ח סעיף י"ד) agree with that opinion as well. It is this latter view which seems to be more widely followed, at least with regards to Tefillah, as pointed out by the Kaf HaChaim (שם סימן רל"ג אות ז'), and affirmed by Rav Moshe Feinstein (שו"ת אגרות משה או"ח חלק א' סימן כ"ד).
The above issue will obviously impact how to determine the precise time on the clock when Minchah Gedolah and Minchah Ketanah will begin on a given day; the question in any case, though, is when the optimal time is for one to daven Minchah. The Gemara in Berachos cited above (שם) does not appear to indicate a preference; the Tur, however (או"ח סימן רל"ג), seems to say, at least as understood by the Beis Yosef (שם בד"ה ומדברי), that the best time to daven Minchah is any time after the beginning of Minchah Gedolah, that is, after 6 1/2 hours of the day have passed. The Beis Yosef (שם) then adds, though, that it appears from the Rambam (פרק ג' מהל' תפילה הלכה ב') that since Tefillas Minchah was designed, as the Gemara in Berachos (שם) states, to correspond to the offering of the afternoon Korban, and since, as cited above from the Mishnah in Pesachim (שם), the afternoon Korban was generally brought at the time of Minchah Ketanah, it would appear that one should preferably daven Minchah at that time, namely, after 9 1/2 hours of the day has passed, although one would technically fulfill his obligation were he to daven earlier, during the Minchah Gedolah period.
The Shulchan Aruch (שם סעיף א') clearly rules that it is preferable to daven Minchah after 9 1/2 hours of the day have passed, namely, during the Minchah Ketanah period; the Magen Avraham earlier (שם סימן רל"ב בהקדמה לסימן) refers to the aforementioned Tosafos in Pesachim (דף ק"ז. בד"ה סמוך) regarding the name "Minchah" as also suggesting that the Tefillah ought to be recited at the time when the Korban was generally brought, that is, after 9 1/2 hours of the day. The Magen Avraham then reiterates (שם סימן רל"ג ס"ק ב') that this is the best time to daven Minchah, although he adds that if one anticipates a situation that might preclude him from davening then, he may certainly daven at the earlier permissible time; the Mishnah Berurah (שם ס"ק א') concurs with this, adding that if one can join a Minyan only at the earlier time, it is certainly preferable to daven then. He does note (שם), however, that some authorities do consider it preferable in general to daven at the earlier time. The Kaf HaChaim (שם אות ג') writes that some actually consider it preferable to wait to daven Minchah until a time even later than the beginning of Minchah Ketanah, a time called Plag HaMinchah which, as explained by the Gemara in Berachos (שם), arrives after 10 3/4 hours of the day have passed; the Beis Yosef (שם סימן רל"ב בד"ה גרסינן) quotes this view as well from the Hagahos Maimoniyos (הל' תפילה שם אות ג'), although he adds that one must be careful not to wait too long so that he won't miss the proper time altogether. The Beis Yosef (שם) explains that this is based on another Gemara in Berachos (דף כ"ט:) which speaks of the importance of davening close to the time of sunset, provided that one does not wait until it is too late; the Kaf HaChaim earlier (שם אות ז') notes that it was the practice of the Ari Zal to daven Minchah just before sunset, and the Pischei Teshuvah (יורה דעה סימן שמ"א ס"ק י"ח) writes as well that the true obligation to daven Minchah sets in only at the very end of the day.
As for the latest time that one may daven Minchah, the Mishnah in Berachos (דף כ"ו.) presents a dispute about whether it is at Plag HaMinchah or at the end of the day; the Aruch HaShulchan writes (או"ח סימן רל"ג סעיף ו') that this dispute too revolves around the afternoon sacrifice, with those who accept the first view holding that the Korban was generally not on the Mizbeiach beyond Plag HaMinchah, while the others hold that it could technically be brought until the end of the day. The Gemara in Berachos (דף כ"ז.) concludes that neither of these opinions is rejected, and one may therefore conduct himself in accordance with whichever one he chooses. The Rambam (הל' תפילה שם הלכה ד') writes that the Minchah Ketanah period lasts until 1 1/4 hours before sunset, implying that one should daven Minchah then, like the former view, but he then says that one may daven Minchah until sunset, like the latter view; although the Aruch HaShulchan (שם) asserts that the Rambam considers the former position to be preferable and the latter to be merely acceptable, the Kessef Mishneh (שם) explains simply that the Rambam is presenting both options, without stating a preference, in accordance with the conclusion of the Gemara (שם).
The Shulchan Aruch (או"ח שם סעיף א') also quotes each of the above views as being acceptable, adding, however, that one should be consistent in one's behavior and not consider on one day that Plag HaMinchah is the end of the time when one may daven Minchah and, consequently, the beginning of the time when one may daven Maariv, and then on another day consider that one may still daven Minchah until the end of the day. This is the explanation given by the Magen Avraham (שם ס"ק ה') and the Mishnah Berurah (שם ס"ק ו'); the Kaf HaChaim (שם אות ט'), however, quotes from the Meiri in Berachos (שם בד"ה מה) that one must be consistent only within the same day, but can change back and forth from day to day, and the Mordechai in Berachos (סימן פ"ט, דף מ"ז. בדפי הרי"ף) appears to agree. It must be stressed that there is a further dispute regarding when "the end of the day" occurs with respect to these Halachos; the Mishnah Berurah (שם ס"ק י"ד) writes that it is at about 1/4 of an hour prior to actual nightfall according to some, while others say that it is at sunset. He then rules (שם) that in a case of great need, one may daven Minchah even after sunset, until that later time, but it is certainly preferable to daven Minchah before sunset; he asserts (שם) that it is better to daven without a Minyan at the right time than with a Minyan later on. Rav Moshe Feinstein (שם) also writes that one should not daven Minchah after sunset except under emergency circumstances. This entire issue also touches upon the question of how to define sunset, the subject of a famous dispute between Rabbeinu Tam (עיין בתוס' לשבת דף ל"ה. בד"ה תרי, ובתוס' לפסחים דף צ"ד. בד"ה רבי יהודה, ובתוס' למנחות דף כ: בד"ה נפסל) and the Vilna Gaon (עיין בביאור הגר"א לסימן רס"א שם בד"ה שהוא); this obviously impacts just how late one may actually daven Minchah.