Samuel was the spiritual leader of Israel and God's prophet for years. When the people decided they wanted a king, he reluctantly presented the desire of the people to God.
God was the king of Israel, but the tribes of Israel had made up their minds that an earthly king and government was needed to protect them against foreign kings.
Wow, I am amazed at the small amount of faith that the tribesmen had in the God who delivered them from Egypt, the king of Moab, and the Philistines. However, God went ahead and gave them what they wanted, an earthly king. Samuel obediently anointed Saul as the king of Israel.
Samuel represented God to the people and he was a righteous man. Samuel told his people in his farewell speech (1 Samuel 12) that he would not sin against the Lord by not praying for them. In fact, he said he would teach them the good and right way.Therefore, he continued to do his best for the people, even when they rejected the kingship of God, and demanded an earthly king.