"And did I choose him out of all the tribes of Israel to be My priest" etc. (1 Samuel 2:28). "Blessed is the man whom Thou choosest and bringest near" (Psalms 65:5) — happy is he who attaches himself to Him; happy is he who attaches himself to Him, and He brings him near. A noblewoman asked Rabbi Yose. She said to him: Whom does your God desire? — He brings near. He brought before her a basket of figs, and she kept picking out the good ones, picking them and eating them. He said to her: You know how to pick out, yet the Holy One, blessed be He, does not know how to pick out? The one whose deeds He sees to be good, him He chooses and brings near. Rabbi Menachma in the name of Rabbi Shmuel bar Rav Yitzchak: Not everyone who is near is near, and not everyone who is far is far. There is one who is chosen and rejected and brought near; there is one who is chosen and rejected and not brought near. Aaron was chosen — "And did I choose him out of all the tribes of Israel to be My priest" (1 Samuel 2:28); and rejected — "And the LORD was very angry with Aaron" (Deuteronomy 9:20); and brought near — "And take thou unto thee Aaron thy brother" (Exodus 28:1). Saul was chosen — "See ye him whom the LORD hath chosen" (1 Samuel 10:24); and rejected — "It repenteth Me that I have set up Saul as king" etc. (ibid. 15:11); and not brought near — "And I have rejected him from reigning over Israel" etc. (ibid. 16:1). David was chosen — "And He chose David His servant" (Psalms 78:70); and rejected — "And the king went forth, and all the people after him, and they stood in a place that was far off" (2 Samuel 15:17). Rabbi Yehoshua ben Levi said: They placed him under a ban, yet even so he accepted his ban upon himself. This is what is written: "And David went up by the ascent of the Mount of Olives, going up and weeping, and his head was covered" (2 Samuel 15:30). And brought near — Rabbi Yudan said: Ira the Jairite was David's teacher, and he brought him near. This is what David says: "Let those that fear Thee return unto me, and those that know Thy testimonies" (Psalms 119:79) — "and they shall know" (vi-yadʿu) is written [the form invites the reading "and they shall know," that they may learn] — this is Ira the Jairite, who was his teacher, and he brought him near.
Chosen, Rejected, and Brought Near - Aaron, Saul, and David
Midrash Shmuel 8:2
ובחור אותו מכל שבטי ישראל לי לכהן וגו' (שמואל א' ב' כ"ח), אשרי תבחר ותקרב (תהלים ס"ה ה'), טובוי דאתחבר ביה, טובוי דאתחבר ביה ומקריב ליה. מטרונא שאלת לרבי יוסי אמרה ליה (מן) [מאן] אלהכון בעי הוא מקריב, הביא לפניה כלכלה של תאנים, והיתה בוררת יפה יפה ובוררתה ואוכלתה, אמר לה את יודעת לבור, והקדוש ברוך הוא אינו יודע לבור (מן) [מאן] דהוא חמי עובדוי טבין הוא בחר ביה ומקרב ליה, רבי מנחמא בשם ר' שמואל בר רב יצחק לא כל הקרוב קרוב ולא כל הרחוק רחוק, יש נבחר ונדחה ונתקרב, יש נבחר ונדחה ולא נתקרב, אהרן נבחר, ובחור אותו מכל שבטי ישראל לי לכהן (שמואל א' ב' כ"ח) ונדחה ובאהרן התאנף ה' (דברים ט' כ') ונתקרב, ואתה הקרב אליך את אהרן אחיך (שמות כ"ח א'), שאול נבחר הראיתם אשר בחר בו ה' (שמואל א' י' כ"ד), ונדחה נחמתי כי המלכתי את שאול וגו' (שם ט"ו י"א), ולא נתקרב, ואני מאסתיו ממלך על ישראל וגו' (שם ט"ז א'), דוד נבחר ויבחר בדוד עבדו (תהלים ע"ח ע'), ונדחה ויצא המלך וכל העם ברגליו ויעמדו בית המרחק (שמואל ב' ט"ו י"ז), רבי יהושע בן לוי אמר נדוהו אף על פי כן קבל עליו נדויו, הדא הוא דכתיב ודוד עולה במעלה הזיתים עולה ובוכה וראש לו חפוי (שמואל ב' ט"ו ל'), ונתקרב אמר רבי יודן עירא היאירי היה רבו [של דוד] וקרבו, הוא שדוד אומר ישובו לי יראיך ויודעי עדותיך (תהלים קי"ט ע"ט) וידעו כתיב, עירא היאירי שהיה רבו וקרבו.