The fourth of the Aseres HaDibros, presented in this week's Parsha, begins with a directive that requires us to remember the day of Shabbos (שמות כ':ח'). Rashi, in his commentary on that Posuk (שם בד"ה זכור), indicates that the commandment here is that one should take care to always remember the Shabbos day so that, for example, if one comes across a fine item (during the week), he should put it away for Shabbos. This interpretation would seem to be based on the Mechilta here (פ' יתרו-בחדש פרשה ז') which states that one should remember the Shabbos starting from the first day of the week, so that if a good portion of something happens to come one's way, he should prepare it for the sake of Shabbos. The Gemara in Beitzah (דף ט"ז.) reports that it was the practice of Shammai HaZakein to always have the honor of Shabbos in mind; if he came across (during the week) a good animal (whose meat he wished to eat), he would designate it for Shabbos, and if he then came across a better one, he would eat (the meat of) the first one, which is comparably inferior, and save the better one for Shabbos, and so on. We thus see that Shammai always thought about the Shabbos and ways to honor it, even when eating during the course of the week (עיין ברש"י לביצה שם בד"ה ואוכל). A similar idea about Shammai is found in the Mechilta DeRabbi Shimon Bar Yochai on the Posuk in our Parsha (םש) which relates that he had the same practice not only regarding food, but even if he bought a new article or a new garment, he would say that it is for Shabbos. It should be noted that the Mishnah Berurah (אורח חיים סימן ר"נ ס"ק ב') points out that although the above sources state that Hillel had a different practice than Shammai regarding this matter, an issue brought up by, among others, the Ramban in his commentary on the Posuk in our Parsha (שם), many Poskim hold that even Hillel agreed that Shammai's position is indeed preferable in most situations.
This notion of remembering the Shabbos during the week and showing it appropriate honor may be subsumed under the general Mitzvah of כבוד שבת, requiring us to honor the Shabbos. The Vilna Gaon (ביאור הגר"א לאו"ח סימן תקכ"ט בד"ה שזהו) writes that כבוד שבת is demonstrated through activities which one does in advance of Shabbos to honor it; Rav Gedalyah Felder, in his Sefer Yesodei Yeshurun (מערכת הלכות שבת, מערכת ערב שבת, כבוד ועונג שבת - חליפת בגדים לשבת), quotes an opinion that we can actually derive from the above Posuk in our Parsha (םש) that we must do certain things in advance of Shabbos, such as bathe, put on finer garments, and other such preparations which will contribute to the pleasure of Shabbos. The Gemara in Shabbos (דף כ"ה:) speaks of the Mitzvah to bathe in preparation for Shabbos, while a later Gemara there (דף קי"ג.), referring to a Posuk in Yeshayah (נ"ח:י"ג), implies that putting on finer clothes for Shabbos is a way of displaying honor; the Gemara in Bava Kamma (דף פ"ב.) indicates that Ezra instituted the practice to wash clothing specifically as a form of preparation for Shabbos. The Gemara still later in Shabbos (דף קי"ט:) teaches that some of the great Amoraim themselves assisted in the preparations for Shabbos by tending to the food and engaging in other tasks, and concludes (בעמוד ב' שם) that one's home should be set up and one's table prepared in honor of Shabbos in order that one may receive a Beracha from the angels who accompany each person to his home after Shul on Friday nights. The Rambam (פרק ל' מהל' שבת הלכות ב'-ו') codifies the requirement to engage in the above activities and other similar ones as the means of fulfilling the Mitzvah of demonstrating כבוד שבת; the Shulchan Aruch discusses these and other pre-Shabbos activities in different places (או"ח סימנים רמ"ב, ר"נ, ר"ס, רס"ב, ועיין בפוסקים שם).
There is some question as to the nature of this Mitzvah of כבוד שבת, requiring advance preparation for Shabbos; it appears from the Midrash Tanchuma in Parshas Bereishis (אות ג') that it is a Mitzvah from the Torah. This position seems to be accepted by the Sefer Yereyim (סימן צ"ח), which refers to a Posuk later in the Torah (ויקרא כ"ו:ב') that speaks about demonstrating מורא, awe, for the Beis HaMikdash, and that then equates Shabbos and the Beis HaMikdash, indicating that there is also a Mitzvah to demonstrate מורא for Shabbos, and this is fulfilled by concentrating in one's heart on honoring Shabbos, among other things. This also seems to be the view of Rabbeinu Bechaya, commenting on a Posuk elsewhere in the Torah (שמות ל"א:ט"ז), as well as of the Magen Avraham (או"ח סימן רנ"א ס"ק ו'), perhaps of the Chayei Adam (הלכות שבת, כלל א' סעיף א'), and of others noted by the Mishnah Berurah in the Biur Halacha (שם סימן ר"נ בד"ה ישכים). The Rambam (פרק ל' שם הלכה א') writes, though, that the Mitzvah of כבוד שבת is MideRabbanan, although it is expressed by the Navi Yeshayah in the Posuk cited above (ישעיהו שם); the Pri Megadim (פתיחה כוללת חלק א' אות י"ח) states this position clearly, although he does add (שם אות י"ט) that some do indeed consider this a Mitzvah MideOraisa. The Mishnah Berurah (שם סימן רמ"ב ס"ק א') briefly discusses this issue and notes significantly in the Shaar HaTziyun (שם אות א') that even, and perhaps especially, if the Mitzvah is MideRabbanan, we must be extremely careful to observe it.
It should be noted that HaRav Yosef Dov Soloveitchik, in an essay on the subject of honoring Shabbos (שעורים לזכר אבא מרי ז"ל כרך א' עמוד נ'-ס"ח), analyzes the position of the Rambam (םש) and explains that the Mitzvah of כבוד שבת is actually a means of properly fulfilling the Torah's Mitzvah of remembering the Shabbos, as mandated by the Posuk in our Parsha (םש); he points out that there are actually two aspects to the Mitzvah of כבוד שבת, one being to actually greet the Shechinah as it arrives on Erev Shabbos, and the second being to get oneself and one's home ready for Shabbos. Rabbeinu Yehudah HaChassid writes in his Sefer Chassidim (סימן קמ"ט) that one should prepare oneself and one's home on Erev Shabbos as though a queen is coming to stay in one's home, and one should do everything necessary to demonstrate proper honor, because the Shabbos is compared to a queen; a similar idea is found in the Mishnah Berurah (שם סימן ר"נ ס"ק ג').
The Gemara in Shabbos (דף קי"ט:) also states that one should set one's table nicely on Motzaei Shabbos as well; Rashi (שם בד"ה במוצ"ש) explains that this too is a demonstration of honor for Shabbos, as one should escort the Shabbos with great honor just as one would escort a king if he were to leave one's presence. The Rambam (שם הלכה ה') thus rules that one should set one's table nicely on Motzaei Shabbos as well in order to honor the Shabbos as it leaves just as one honors it as it enters; the Shulchan Aruch (שם סימן ש' סעיף א') also rules that one should escort the Shabbos away by setting a nice table on Motzaei Shabbos. The Taz (שם ס"ק א') indicates that one should set the table with a tablecloth and other items which he normally puts there when setting a nice table, because this is a form of honor for Shabbos; the Mishnah Berurah (שם ס"ק א') and the Kaf HaChaim (שם אות ג') accept this position. The Machatzis HaShekel (שם בריש הסימן) mentions the practice to have candles at the table then like one does on Friday night, as do, among others the Shulchan Aruch HaRav (שם סעיף ב'), the Chayei Adam (שם כלל ח' סעיף ל"ה), and the Mishnah Berurah (שם ס"ק ג'), who also cite the practice of singing special Zemiros on Motzaei Shabbos, as does the Taz (םש).
The Vilna Gaon (ביאור הגר"א שם בד"ה לכזית) writes that one must have a meal at this time with bread, and the Chayei Adam (שם סעיף ל"ו) agrees that this is preferred, noting that this meal is what we call the Melaveh Malkah (escorting the queen) meal; the Mishnah Berurah (שם ס"ק א') also states that the simple reading of the Gemara (שם) indicates that one must have bread at this meal (עיין שם בשער הציון אות ב'), and the Kaf HaChaim (שם אות ה') seems to prefer this as well, adding that it may be proper to have two loaves on the table. The Chayei Adam (םש) asserts, though, that if one can not have bread, he should have cake (or any food on which the Beracha of "Mezonos" is recited); the Mishnah Berurah (םש) concurs, adding that if there is no other choice, one should just have some fruit. This ruling is presented as well by the Magen Avraham (שם בריש הסימן), but he also writes that it is preferable to eat meat at this meal, as is implied by the same Gemara in Shabbos (םש); the Maharsha (חדושי אגדות שם בד"ה פת) writes that it is proper to have a newly prepared food item, cooked specifically for the Seudas Melaveh Malkah, to enjoy then, and the Kaf HaChaim (שם אות ח') agrees, adding that one should eat something he truly desires at this meal, even if it is expensive, an idea also found in the Be'er Heitev (שם ס"ק א'). It should be noted that the Shulchan Aruch HaRav (שם סעיף ג') writes that eating this Seudah is not really an absolute obligation, but rather a מצוה מן המובחר, a preferred practice, and the Mishnah Berurah (שם ס"ק ב') also states that the obligation to eat this meal is not as great as the obligation to eat the other Shabbos meals (ועיין שם בשער הציון אות ט'). This, however, may not be the majority view, and the Kaf HaChaim (שם אות ד') writes that one should make every effort, even if one is still full from his Shabbos meals, to eat this meal on Motzaei Shabbos.
The Mishnah Berurah (שם) rules that it is proper to begin this meal shortly after Shabbos ends, explaining in the Shaar HaTziyun (שם אות ה') that since this meal, as noted above, was instituted as a means to escort the Shabbos queen away, the correct time to have it is right when Shabbos has just ended and not after one has already engaged in various other activities; if, however, one can not eat then, one may eat anytime until midnight. The Kaf HaChaim (שם אות י"ד) quotes a view that one must eat this meal by no later than four hours into the night, but he also quotes that the Ben Ish Chai (שנה שניה, פרשת ויצא אות כ"ז) writes that while that is the preferred view, one may eat the meal until midnight. It is reported in the Sefer Maaseh Rav, which presents many of the practices of the Vilna Gaon (תוספת מעשה רב אות ל"ט), that the Gaon was once sick on Motzaei Shabbos and could not eat when Shabbos first ended, and he thus ate his Melaveh Malkah meal early the next morning (before dawn), implying that under pressing circumstances, one may eat this meal even after midnight (but before the next day begins.) Incidentally, it is also clear from that same passage (םש) that women must eat the Seudas Melaveh Malkah too, as also stated clearly by the Machatzis HaShekel (םש) and the Pri Megadim (באשל אברהם שם ס"ק א'); the Kaf HaChaim (שם סוף אות ב') accepts this ruling, adding (שם אות ד') that some write that a woman who is careful to eat the Seudas Melaveh Malkah will have an easier time in childbirth.
The Kaf HaChaim (שם אות ו') writes that the נפש יתירה, the "extra soul," that one had during the course of Shabbos does not depart completely until after this meal is eaten, and that one should therefore not engage in any other activities prior to eating the Melaveh Malkah meal, a point noted as well by the Mishnah Berurah (םש). The Kaf HaChaim (םש) also writes that one should not remove one's Shabbos clothes until after eating this meal. The Beis Yosef, commenting on the Tur (שם בד"ה לעולם), writes that there is a certain limb in one's body which is not nourished by any meal other than this meal eaten on Motzaei Shabbos. The Sefer Maavar Yabok (מאמר שפת אמת פרק ו') indicates that it is through this limb that one's body comes back to life at the time of Techiyas HaMeisim; the Mishnah Berurah (םש) mentions this idea as well to demonstrate the importance of eating the Seudas Melaveh Malkah. The Aruch HaShulchan (שם סעיף ג') notes that many people are unfortunately not careful to eat this meal, but he writes that one should try one's utmost to do so because the reward for this Mitzvah is very great.