Why did the tempter leave Jesus?
Because the tempter went in search of someone who would yield to sin, as it is written, "Evil pursues sinners," (that is, not the righteous). Proverbs 13:21.
Because Scripture was in his heart, as it says, "I will keep your words in my heart, that I might not sin against You." (Psalm 119:11)
Because he resisted temptation, as it is written, "Resist the devil, and he will flee from you." (James 4:7)
And why did the angels come?
It is written, "The angel of the Lord encamps around those who fear him." (Psalm 34:7) And again, "Let the angel of the Lord chase them away" -- that is, those who seek after his soul. (Psalm 35:5)