The handful of moderately large instances that have shut down rhat I'm aware of gave long notices, in a couple of cases over a year, before actually going offline.
The only notable counterexample I remember was BitcoinHackers.org shutting down suddenly with a note saying "haha look at how easy it is for mastodon instances to shut down go use nostr", making it a self-fulfilling prophecy in that case. If you have other examples I would like to know about them.
I've personally had to migrate instances twice. The first time because the instance suddenly became nonfunctional, and the administrator went AWOL. The second time, I discovered that the incompetent admin had silently enabled auto-deletion of data including posts and direct messages.
Now I'm finally on mastodon.social, which wasn't open for new users the first two times that I needed an instance.
The only notable counterexample I remember was BitcoinHackers.org shutting down suddenly with a note saying "haha look at how easy it is for mastodon instances to shut down go use nostr", making it a self-fulfilling prophecy in that case. If you have other examples I would like to know about them.