It’s a downside of many grid tied residential systems (even large ones). No grid = no solar.
The Enphase IQ8 series is one of the first mass market micro inverters based systems to have the ability to make its own tiny electric island when the grid goes down. Requires an isolation switch and a relatively power hungry controller to use that feature, though. I looked into them for a balcony solar setup but it would be way overkill to run a full on controller for 800w of solar!
The best way for a small setup is just have a small “solar generator” battery that can take MC4 connectors as input. Prolonged power outage? Unplug the inverter, plug in the battery.
Not especially, given that the inverter has a microprocessor in it. All it has to do is measure the phase of the existing grid.
I don't have references for how it's actually done, but one obvious approach is simply to wait at each zero-crossing for a new half-cycle to cross a voltage threshold before turning on the output. This also implements the requirement to drop out if the grid goes away. It is probably also possible to measure during the "off" side of inverter output PWM, in the same way that variable frequency motor drivers work.
If everyone plugged one in, could the transmission network reliably deliver the power generated where it's needed? I thought that was a serious long term challenge for utilities wrt solar.
Some systems are capable of running in isolation from grid (providing 230V AC on their own), but this is less common and often unnecessary.