Could anybody tell me when do you use "here" and "there" at the beginning of a sentence? I am sure I have heard the following sentences but I can't explain why they are used in such a way.

Here we go again!

Could we have some more examples?

Here we are.
Here's something to look at.
Here is where it happened.

There is something to look at
There you go (If you just gave somebody something, or did something for somebody, you would say this)