1 Samuel 1:10,11 10 In bitterness of soul Hannah wept much and prayed to the LORD . 11 And she made a vow, saying, "O LORD Almighty, if you will only look upon your servant's misery and remember me, and not forget your servant but give her a son, then I will give him to the LORD for all the days of his life, and no razor will ever be used on his head."
In trying to research bargaining with God, I have found that most people don't want deal with the topic. Its true that we don't have anything to give. On the other hand bargaining with God seems to be many places in the scripture. Abraham bargains with God about the future of the cities of Sodom and Gomorrah. Moses bargains with God not to destroy the children of Israel. In a sense the bargaining is a communication tool for God to talk with man. God often asks people questions in the scriptures. He is not lacking knowledge, he is omniscient. God asks us questions so we are prepared to hear the answers. His thoughts are not our thoughts. His ways are not our ways so sometimes he reveals himself step by step bringing us along to the point where we need to be. God was not lacking a priest and so he was so glad when Hannah offered up her son. He was working in her heart. He was preparing her for service. He was preparing Samuel for service. While sometimes people try to bargain with God it is just them pulling out all stops before they loose what they hold dear, at other times it is a part of God preparing them or others for service and grace.