Hannah did not have what society valued in a woman and what she herself wanted desperately. The other wife had many children but lacked the love of their husband. She acted out her resentment and jealousy.
Elkanah did notice that Hannah was upset but didn't know or wouldn't admit knowing why.
We can generalize and modernize this situation. Some people have more things than others do. The haves sometimes lord it over the have-nots. Jealousy affects us badly. People in authority sometimes are clueless.
In Hannah's case, she was determined to make her life better. Her solution was prayer.
When he saw her praying, the religious authority assumed she was drunk. Was he also clueless? Or, was he that unaccustomed to seeing fervent prayer?
Hannah responded to his criticism by explaining who she was and what her situation was.
Eli may not have discerned her sincerity before, but after hearing, he could. He told Hannah that God was going to grant her petition.