God had ruled Israel through judges whom He raised up to deliver Israel until the people of Israel asked Samuel for a king. In asking for a king, they rejected God’s rule. They asked for a king and the king they got was Saul. He failed miserably, refusing to obey the Lord. God rejected him.
After being rebuked, Samuel was obedient to go to the house of Jesse in order to anoint the new king. He went under the pretense of making a sacrificing since Samuel was afraid that Saul might harm him since he had to pass through his town in order to get to Jerusalem and to Jesse’s household.
Once at Jesse’s home, Samuel was “sure” that the oldest son, Eliab, was the man, but God said no, responding that God looks at the heart, and not at the outward appearance: I Samuel 16:7 But the Lord said to Samuel, “Do not look on his appearance or on the height of his stature, because I have rejected him. For the Lord sees not as man sees: man looks on the outward appearance, but the Lord looks on the heart.”
Eventually, the older brothers go to the pastures to get David, who is anointed. 16:13: And the Spirit of the LORD rushed upon David from that day forward.