Kai’s shelf · Street Japanese
はい
hai
A polite response that shows agreement, answers a called name, or draws attention; it can also end one's own remark to sound humble or emphatic.
Who says it, and who it is for
People use it for replying, acknowledging what someone says, answering when called, and getting attention. It is the choice with superiors or in formal settings, while うん suits close acquaintances and ええ sits in between.
Where it comes from
It is a kana word with no assigned kanji. According to 日本国語大辞典, the earliest example of its use as a reply is in a sharebook (comic fiction) of 1774. The difference from うん has traditionally been explained as politeness, but a 2016 study by Yamamoto Mari, based on the Corpus of Spontaneous Japanese, suggests the two may also be used differently depending on the speaker's role in the exchange, such as at the point where an explanation ends and a restatement is finished. As a backchannel, はい is often a sign of "I'm listening" rather than agreement.
Cross-checked with a major dictionary or an official body. Sources: kotobank.jp; repository.ninjal.ac.jp.
Ask about はい in WAORI →The page is the dictionary. The conversation is where the word opens up.