If you just read parshas לך לך you would think that first Hashem told Avraham to go to Eretz Yisroel, then came the story with לוט etc, and then came the ברית בין הבתרים. However, the Rishonim point out that if we take a closer look at the chronology we see that this is not true.
Hashem tells Avraham by the ברית בין הבתרים that his descendents will be in golus 400 years. Rashi points out that we were only in Egypt 210 years and therefore explains based on the medrashim that the 400 years started with the birth of Yitzchak. However, the Torah says in Parshas Bo that we were in Egypt 430 years. Rashi there explains (again based on medrashim) that the extra 30 years is from the ברית בין הבתרים, in other words the ברית בין הבתרים was 30 years before Yitzchak was born. We know that Yitzchak was born when Avraham was 100 years old which means that ברית בין הבתרים had to be 30 years earlier when Avraham was 70. However, at the beginning of parshas לך לך the Torah tells us that Avraham was 75 years old when he left Charan. This means that לך לך had to be 5 years after the ברית בין הבתרים. Tosafos in Shabbos 10b makes this calculation and says this is what happened. Avraham came to EY when he was 70 and went through the ברית בין הבתרים, and then he returned to Charan for 5 years until Hashem told him לך לך.
The question we have now is why is the Torah written this way? What is the lesson we are supposed to learn from the way the Torah ordered things? Tosafos points out the discrepancy but doesn't explain why.