"'There is still the youngest,' Jesse answered. 'He is tending the sheep.'" — 1 Samuel 16:11
One by one, the sons of Jesse pass before the prophet Samuel. When Samuel sees Eliab, the eldest son, he says to himself, “Surely the LORD’s anointed stands here.” But the Lord says, in effect, “You’re only looking at appearances, but I look at the heart.”
When seven of Jesse’s sons have passed before him, Samuel tells Jesse, “The LORD has not chosen these.” So then the youngest, the shepherd-boy David, is summoned from the fields—and at God’s command Samuel anoints him king over God’s people.
David turns out to be a much better king than Saul, the first king of Israel. Yet David too has flaws and failings of his own. But God, who sees what we cannot, chooses David, indicating he is “a man after [God’s] own heart” (1 Samuel 13:14). Throughout David’s story and in the psalms he wrote, we see a sensitivity and a wonder at God’s glory and power, as well as a deep sense of humility before God, especially when he fails. These qualities make him not only a good king but also a suitable shepherd for God’s people.
Later God makes a promise to David that his throne will be established forever (2 Samuel 7). And this means that God will bring from David’s line the very greatest King and Shepherd, Jesus Christ.