Find out when page is opened in new-window or new-tab?

You would compare the length of the history to the number you would expect on a new page.

Yes.

No, because the history also contains the current page that you are on, so you would compare it with 1.

You can get some further details about it at Manipulating the browser history