Power users often have dozens of documents open in Safari at any one time, some possibly for months at a time, and it can be infuriating to have Safari crash or for some other reason lose everything you had open. Here's how to get it all back.
I tend to accumulate too many open web documents. Right now, I have ten windows up, each of which has four or more open web pages, and that's only because I just went through and closed a bunch I didn't need. I've had some open for months, because I haven't gotten around to reading them, or because I've been actually using them this whole time (on and off) for a project.
As far as browsers go, Safari isn't too bad, but its crash protection is basically nonexistent, or at least it was when I started using Tiger. At the time, I installed Saft, and I never looked back. Even with Saft, however, Safari isn't perfectly reliable. There are a number of ways that your session might be lost. Safari or an in-process add-on might corrupt memory, thereby corrupting your session info. There might be a kernel panic at just the wrong time. Another sure way to destroy your session is to quit the browser while in Private Browsing mode. (No session info gets stores on quit, so when you reopen, 'Reopen All Windows From Last Session' gives you nothing or junk.) And another way is to start Safari with no internet connection, try (and fail) to reload your last session, and then quit. (Now, connection errors are your last session.)
This hint assumes that you do very regular backups. I have a Time Capsule and therefore backup every hour while at home. This is important. If you don't have a backup from just before you lost your session, you're out of luck.
If you are not using Saft, then the file you need to find is:
If you ARE using Saft, it seems to interfere with sessions being saved in LastSession.plist (mine contains mostly Top Sites tabs), and in any case, it stores its session restore info in an entirely different place:
First, quit Safari. Then find whichever one is right for you and make a backup copy. Click on the filename, and then enter Time Machine. Now, the trick is to figure out how far back you have to go to find the most recent valid session. This may take a few tries. Restore the file from backup to its original location. Then restart Safari. If you're using Saft, the session will restore automatically. If not, you'll have to select 'Reopen All Windows From Last Session' from the History menu. You may have to try again if you picked one that was too old or too new (corrupted or post-corruption).
[crarko adds: I haven't tested this one. It is a use for Time Machine I might not have thought of on my own.]
Mac OS X Hints