Hola
In spanish, it's important when you're speaking about a "know thing" (something you're searching, you know it exists, something you have heard of) and a "unknow thing". The first ones are with "esta", because you're looking/expecting them. The "unknow" thing comes with "Hay" because it's simply there.
So when you say "the book " it's a know one, so "está"
When you say "a book" you're not expecting it, so "hay"
Here's the book
El libro está aquí
OK
Aquí está el libro OK, but only when you want to remark the fact of the position (look, HERE is the book)
There's the book
El libro está allí
OK
Allí está el libro OK, but only when you want to remark the fact of the position (look, THERE is the book)
There's a book
Hay un libro allí
OK
Allí hay un libro
OK
(alli) está un libro see explanation above.
There's a book on the table
Hay un libro en la mesa OK
Alli esta un libro en la mesa/ Un libro esta en la mesa see explanation above.
Is there a book on the table?
¿Hay un libro en la mesa? OK
¿Esta un libro en la mesa? NOK see explanation above.
¿El libro esta en la mesa? NOK see explanation above.
¿El libro esta en la mesa? as ¿Is the book on the table? it's OK
Hope it helps