These (3) words may be tricky for some beginners and even for native speakers. We are going to see in these examples how we should use them.
1) "¡Ay!" is used to exclaim. e.g. ¡Ay olvidé hacer mi tarea! / I forgot to do my homework!
2) "Hay" means there is and there are, e.g. Hay niños en el parque / There are children in the park.
Hay una manzana sobre la mesa / There is an apple on the table.
3) "Ahí" means there/ just there e.g.
Lanza el periódico ahí junto a la casa número 4 /
Throw the newspaper over there, next to the house number 4