How to use teamviewer if the remote computer has restarted?

You can set teamviewer up for unattended access. This installs a Windows Service so you can access the computer without being logged in / starting Teamviewer. You can see the exact instructions on teamviewer.com (http://www.teamviewer.com/en/res/pdf/first-steps-unattended-access-en.pdf)

In short, if you open the Teamviewer window, there's a small box for a password for unattended access on the bottom left side. When you fill in the password (Personal Password), you will set up your unattended access.

You can also create a teamviewer account, log in from the application and add the computer to your list. Once you're logged in on another computer, simply double-click the computer from the list and you'll start a remote session.

Again, more info and detailed information on http://www.teamviewer.com