There was a certain man of Ramathaim-zophim of the hill country of Ephraim whose name was Elkanah the son of Jeroham, son of Elihu, son of Tohu, son of Zuph, an Ephrathite. He had two wives. The name of the one was Hannah, and the name of the other, Peninnah. And Peninnah had children, but Hannah had no children. (1 Samuel 1:1,2)
Hannah desperately wanted a son and promised God that if he gave her a son she would give him back to God to serve him.
And she vowed a vow and said, “O LORD of hosts, if you will indeed look on the affliction of your servant and remember me and not forget your servant, but will give to your servant a son, then I will give him to the LORD all the days of his life, and no razor shall touch his head.” (1 Samuel 1:11)
God answered her prayer. God gave her a son and she named him Samuel. When he was old enough she brought him to the house of God and gave him to Eli the priest.
And when she had weaned him, she took him up with her, along with a three-year-old bull, an ephah of flour, and a skin of wine, and she brought him to the house of the Lord at Shiloh. And the child was young.Then they slaughtered the bull, and they brought the child to Eli. (1 Samuel 1:24,25)