1 Samuel 1:11

"And she made a vow, saying, 'Lord Almighty, if you will only look on 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.'" NIV translation

Long hair was one of the characteristics of the Nazirite vow and a Nazarite was one who was set apart for God.

Hannah promised the Lord that, if He gave her a son, she would give him back to God in service.

We see her humility in this promise as it could not be easy for any woman to give up her only child. But, by humbling herself, her shame at not having a son would be removed. She would, in fact, be honored as it was quite an honor to have a son that was a priest.

1 Samuel 1:12 - 14

"As she kept on praying to the Lord, Eli observed her mouth. Hannah was praying in her heart, and her lips were moving but her voice was not heard. Eli thought she was drunk and said to her, 'How long are you going to stay drunk? Put away your wine.'" NIV translation

As she prayed, Eli the priest was watching and accused her of being drunk because he did not understand what was happening. Evidently, he was more used to seeing drunks at the House of the Lord than seeing people actually praying to God. He was quick to make a judgment about her and we can fall into that as well. For a modern parable on this topic, check out Simon's Tears.