1 Samuel 16:7: "...but the LORD looks at the heart."

But the LORD said to Samuel, "Do not consider his appearance or his height, for I have rejected him. The LORD does not look at the things man looks at. Man looks at the outward appearance, but the LORD looks at the heart." (1 Samuel 16:7, NIV)

The full passage: 1 Samuel 15:1-16:23:
Why can't Samuel recognize the next king? God says why he can't in the verse above, 1 Samuel 16:7. However, God also made this statement in a larger context. When Samuel anointed Saul as king, he was a head taller than the rest of Israel
(1 Samuel 9:1-2; 10:23-24)
. His size made him stand out among the people. Yet, in 1 Samuel 15:1-35, Saul's dynasty ends with him because he failed to follow God's instructions.
In stark contrast to Saul, David was still a boy when Samuel anointed him king. He was the youngest of eight brothers. As the youngest brother, David stayed with the sheep when his father and brothers went to the sacrifice with Samuel. They had to go get him because no one thought he would be the one anointed king
(1 Samuel 16:11-13)
. A good translation of the statement in 1 Samuel 16:7 is the following.

"For [the LORD does] not [see a person] as a man sees [him]. A man sees [him] with [his] eyes, but the LORD sees [his] heart."

The context doesn't end here. When Goliath challenged the Israelites, no one, including Saul accepted it
(1 Samuel 17:1-11)
, because Goliath was much larger. However, David came to the battle area bringing food to his three oldest brothers
(1 Samuel 17:11-24)
. David, with his shepherd-boy clothes and weapon
(1 Samuel 17:32-40)
, accepted the challenge of the giant Goliath. Goliath died laughing
(1 Samuel 17:41-51)
When Saul realized God had chosen David to succeed him, he pursued David even when his own son recognized God chose David
(1 Samuel 18:28; 1 Samuel 19:1-20:42; 23:17-18)
. In contrast, David spared Saul's life, but Saul sought to kill David
(1 Samuel 24:4-22; 26:6-25)
. David realized it was up to God to make him king.
David didn't have a passive personality. He was a fierce warrior and used his God-given opportunities. After David and his men lived among the Philistines
(1 Samuel 27:1-12)
, Israel no longer needed to go to the Philistines for iron tools
(1 Samuel 13:19-22)
. Apparently, they learned the Philistines' secret. But, David realized taking the opportunities God gave meant doing what was right rather than making one's own opportunities through justifying the wrong means. Saul was willing to let the end justify the means
(1 Samuel 13:8-14; 15:1-30)
. Saul's behavior approached insanity.
In case those earnestly seeking to do God's will misplace their pride, history continues with David committing the grievous crimes of adultery with Bathsheba and the murder of her husband
(2 Samuel 11:1-15)
, Uriah. From outward appearance, Saul's disobedience
(1 Samuel 15:1-35)
seems petty compared to David's crimes. Both of David's crimes carried a death sentence under Jewish law. The murder of Uriah could carry a death sentence even today.
However, David's response to the rebuke from God's prophet was very different from Saul's. When Nathan confronted David, he acknowledged the seriousness of his sins
(2 Samuel 12:1-22)
. Saul denied his sin until Samuel told him the consequences
(1 Samuel 15:19-31)
. Then, Saul spent the rest of his life trying to kill David to undo those consequences.

No matter how much we turn our thoughts, desires, and feelings over to God, we still fall short of God's heart. But, how open are we to God's correction in our lives? How receptive are we to whoever or whatever God sends to correct us?