How to proceed when PhD advisor leaves academia or moves to a new university midway?
One issue is what your advisor is doing.  If your advisor is leaving academia (e.g., going to work on Wall Street or for the government), then you are probably on your own, but moving to another university is generally not a big problem.

If you haven't started doing research yet, you should probably just switch to a new advisor, but if you are already making progress, then staying with your current advisor is often the best approach.

One possibility that wasn't mentioned in your question is moving physically to the new university as a visiting student while staying enrolled at the old university.  You still work on research with your advisor, and at the end receive a degree from the university you started at.  Maybe it varies between fields, but this is pretty common in mathematics, and it avoids some of the difficulties like transferring credit or different requirements.

If your advisor is supportive (and they should be!), then this is generally not hard to arrange.  It's easiest if they are technically going on leave from the old university, rather than resigning immediately, but that's a pretty common way to arrange moving between universities, partly because it simplifies situations like this.  (And even if your advisor is not going on leave, you just need a colleague to step in as the formal advisor, while letting your advisor handle the day to day interaction.)  The major reason for difficulty would be if there was some serious problem at the old university, such as a personality conflict with the department chair, which could make the department unwilling to be flexible.