Hashem appeared to Ya'akov after the conclusion of the battle with Shechem and ordered him to return to Beit El. Why did G-d need to order Ya'akov to return to Beit El, his home? The opening of Parshas VaYeitzei tells us that Ya'akov intended and promised (with G-d's help) to return home -- his stay in Lavan's home was just a temporary escape from Eisav. Ya'akov had also already been told while in Lavan's home that it was time to leave, and he was already on the road, ostensibly headed back home. Rashi cites a snippit of Midrash Tanchuma to answer this question, but it's worth seeing the text of the Midrash in its entirety:
בא וראה כשהלך יעקב לארם נהרים מה כתיב שם וידר יעקב נדר לאמר וגו' (בראשית כח), השיבו על כל דבר ודבר, הלך ונתעשר ובא וישב לו ולא שלם את נדרו הביא עליו עשו ובקש להרגו נטל ממנו כל אותו דורון עזים מאתים לא הרגיש, הביא עליו המלאך ורפש עמו ולא הרגו שנאמר ויותר יעקב לבדו ויאבק איש עמו זה סמאל שרו של עשו שבקש להרגו שנאמר וירא כי לא יכול לו ונעשה צולע, כיון שלא הרגיש באת עליו צרת דינה שנאמר ותצא דינה, כיון שלא הרגיש באת עליו צרת רחל שנאמר ותמת רחל ותקבר, מסייע ליה לרב שמואל בר נחמן דאמר כל הנודר ואינו משלם גורם לאשתו שתמות שנאמר אם אין לך לשלם וגו' אמר הקב"ה עד מתי יהא הצדיק הזה לוקה ואינו מרגיש באיזה חטא לוקה הריני מודיעו
The Tanchuma answers that G-d reiterates his command to Ya'akov to return home because Ya'akov had delayed in fulfilling his promise to do so. Through its answer, the Midrash also manages to tie together the many disparate episodes of the parsha -- Eisav, the angel, Shechem, Rachel's death -- quite nicely. All are a punishment for Ya'akov's delay.
A few points:
1. Textual -- the Midrash sees the death of Rachel as part of the punishment for Ya'akov's delay, yet, the death of Rachel is written in the parsha only after G-d appears again to order Ya'akov home. It seems a stretch to suggest based on this Midrash alone that events are written out of order. I have no good answer.
2. Moral -- The subtle hint of repeated punishment is apparently lost on Ya'akov, who trudges along through difficulty after difficulty not realizing that his behavior is his own worst enemy. If Ya'akov, the bechir ha'avos, could not grasp that G-d was trying to tell him something even after receiving patch after patch, we who have no nevuah and are groping in the dark for direction surely stand a good chance of remaining confounded and confused even as G-d sends signal after signal our way (see R' Shternbruch's Ta'am v'Da'as).
3. Halachic -- The Midrash assumes (as does the Zohar) that a person's wife may even die as a result of his delaying fulfillment of a neder. (My wife jokingly commented that this may suggest a strategy to those who wish to get rid of their spouse-- hopefully not!) Yet, the gemara (Rosh haShana 6a) states clearly that this is not the case, darshening, "V'haya becha cheit" -- v'lo b'ishtecha cheit. A simple answer is that Rachel was not punished directly for Ya'akov's delay, but she simply suffered the natural effects of danger during childbirth, which more often led to death in ancient times. Had Ya'akov been more careful, Rachel might have been afforded the supernatual protection that comes of extra zechus. See the Kli Chemdah for a more complex pilpul on the topic.