Rashi on the Former Prophets
1 Samuel 27
Now I might perish one day. Perhaps he will ambush me and suddenly attack me.
Why should your servant remain… And be a burden to you.
Days and four months. The minimum [number] of days is two. It is impossible to explain this word, 'יָמִים' as a year because Dovid did not go to Achish until Shmuel had died, and Shaul only reigned after Shmuel's death four months, as we learned in Seder Olam. Also [this can be deduced from the following:] the number of Eili's years [forty years which he judged Yisroel], and the twenty years that the Ark was in Kiryas Ye'arim total sixty years. Subtract from that Shmuel's fifty-two years, plus one year from his conception, with these four months, plus the seven years which Dovid reigned in Chevron before he brought the Ark from Kiryas Ye'arim. This [calculation] discloses that Shaul reigned after Shmuel's death but four months.
Dovid…would go up. This is the present tense, i.e., he was always accustomed doing this.
In the direction of Shur. From the entrance of Shur.
Where did you raid. The 'ל' is interchangeable with a 'נ' [so the word אֶל=אָן which means 'where'], as in "he prepared a large chamber [נִשְׁכָּה]," in the Book of Ezra, meaning the equivalent of לִשְׁכָּה [=chamber].
You arrive at the cited line; the whole work is yours to read around it. The text is set from the cited public-domain edition.