Question: I have a (web) server at a datacenter, which at times (as all datacenters do) has network failures (for like 10-30 minutes).

I have a second server at a different company (datacenter) which I could use as a failover solution.

Now, I was wondering how I could do that? Of course I can mirror the site. The problem is, how do I achieve this: When the main server let's say IP: 1.2.3.4 at datacenter A is not reachable from the outside world, how does my second server at IP: 4.3.2.1 automatically resume its work as main server ?

I don't think that round robin dns would be a solution, because half the requests will be directed to the server which is not reachable.

my servers are windows, IIs

Answer: 
You need to place the load balancer off site. Colocate a redundant hardware loadbalancer in a high-uptime third datacenter(costly but v.nice) or use a cloud service to deploy a redundant software load balancer(way cheaper). If you really can't get the budget, go dns.
You are right - round robin DNS would not be a solution in this case. What you need is a DNS service that monitors the availability of your servers and switches over the DNS record for the web site to a failover IP once a problem occurs.

An example of such a service is [DNS Made Easy's DNS failover service](http://www.dnsmadeeasy.com/services/dns-failover-system-monitoring/).