Is it necessary to eject external drives before logging out, restarting, or shutting down? Is it necessary or recommended practice to eject external drives before logging out, restarting, or shutting down? (The drives are not being unplugged.)

BTW, I am aware that I need to eject my external drives before unplugging them, I just don't know if it's necessary when logging out or shutting down. It seems to me this should be obvious, but I can't find an explicit answer to this question anywhere. I am interested in answers for Snow Leopard, Lion &amp; Mountain Lion OS versions, as I have 2 machines, one with Snow Leopard, the other with Lion, &amp; I'll soon be upgrading Lion to Mountain Lion.
No, it's only recommended when unplugging the cable.

The reason why you eject is so that any processes reading and writing from the disk will cause OS X to notify you of the disk being in use and prevent data corruption that can occur by just unplugging the disk while it's in use.

Additionally the OS might queue different write operations to a cache before actually writing them to disk, and ejecting will make sure these are flushed to the drive before it is disconnected.

Halting any processes from reading/writing to the disk and flushing the caches is implied when rebooting or shutting down the machine (unless you do a cold shutdown by pressing and holding the power button to turn it off). When logging out, the OS can flush the cache at its own discretion.