When multitasking in OS X it is not uncommon to have a Web browser open, such as Safari or Firefox, and have multiple tabs open in multiple windows. Sometimes this results in clutter that is quickly managed by pressing Command-W multiple times to rapidly close the tabs, which can lead to the inadvertent closing of needed windows.
While you can use the browser's history menu to quickly open recently visited pages, in some instances the page that was closed had been open for a while, and as such be harder to find or even remember what it was.
If you find yourself in a situation where you need to quickly reopen a page in Safari, then there are several options you can use to do so.
In instances where you have just closed tab or two and need to restore them, then a quick press of Command-Z or choosing Undo from the Edit menu will restore them. Unfortunately the Undo option will only work on the current window, so if you close an entire window containing tabs, then the Undo command will work on the next active window and not the one that was closed. However, you can still restore the last closed window by choosing Reopen Last Closed Window from the History menu.
In addition to restoring the last closed window, you can restore all windows from the last time Safari was open by selecting the option to do so from the same History menu. This option is a little redundant to Apple's Resume feature that should perform a similar function in OS X Lion, but offers you the ability to restore your session if you have disabled Resume in the General system preferences.
If you use Firefox or Chrome instead of Safari, these browsers have similar options. Unfortunately neither make use of the Undo feature to restore tabs or windows, but you can use the History menu to access various tab and restore functions in these browsers.
Browse or Search History
While Safari's History menu will populate with submenus containing pages visited at certain times, if you are looking for specific content and do not remember the page name or URL then it may be difficult to find the page using just the menu. As an alternative, you can use the history search feature in Safari to find the page that was lost in a closed window or tab. To do this, choose Show all history from the History menu, and the resulting window will show you a preview and the list of items stored in the browser's history, which you can use to preview the pages for the lost one.
In addition to browsing, you can provide search terms in the small search field and then browse through the resulting previews to find your lost page.
While Firefox, Chrome, and Safari all have similar options for browsing and searching the history for pages you might like to restore, only Safari offers an option to preview the pages in the history and provide you an option to visually identify lost pages.