An interjection (感叹词) is a word or expression that occurs as an utterance on its own and expresses a spontaneous feeling or reaction. It expresses feelings and emotions but does not name them. It is usually placed at the beginning of a sentence.
The interjection 唉 has several meanings and readings:
1) 唉 expresses agreement or readiness. It can be translated as “uh-huh!”, “okay!”.
Okay, I'll go then
āi, nà wǒ xiān zǒu le
Uh-huh, if only he knew English!
āi, yàoshi tā dǒng yīngyǔ gāi duō hǎo a
Uh-huh, I got it
āi, wǒ zhīdào le
2) 唉 expresses annoyance or regret. It can be translated as “alas”.
Alas, my computer crashed again!
ài! wǒ de diànnǎo yòu dāngjī le
Alas, he fell and hurt himself!
ài! tā bù xiǎoxīn shuāishāng le
The sound-imitative word 唉唉
Sound-imitative words are also called "onomatopoeia" (象声词).
When repeated, the onomatopoeia 唉唉 imitates the sound when someone is crying or whimpering.