Though I don't have any problems getting myself to sleep at night, I always like to have some music or a podcast or something else to accompany me through those few minutes from the moment I put my head on the pillow and until I "pass out". Of course, leaving the computer on all night long for that is a bit unnecessary so auto-shutdown is the best solution. And on Linux, it's super easy to set up.
But enough with the introduction, here's how you do it.
Open the good ol' terminal and type the following command: sudo shutdown -h -P hh:mm (replace hh:mm with the time in 24-hour format - e.g 22:45), press Enter, type in your password if necessary and that's it. Your machine will shut itself down at the scheduled time. No questions asked, no nothing. If something happens and you want to cancel the countdown, press CTRL+C in the same terminal. If you closed the window in which you initiated the shutdown procedure, type sudo shutdown -c to cancel. Simple!
Buuut, as simple as it is, I know that there are many of you who suffer from severe command-line interface allergy, thus I will also show you a graphical alternative: GShutdown. If you're running a Debian system, you will find it in the repositories, otherwise download a package suited to your distro here.
In GShutdown you can select from three ways to turn off your PC: at a specified time AND date, after a set delay or "now" (a bit useless this last one, no? - except for testing purposes that is :) ). If you simply want to restart or end the session, you can also do that from the bottom drop-down menu. Select the date from the calendar, set the time and press start. Everything should work just fine, but if something is acting up, you can go in the Preferences and manually specify the desktop environment and display manager that you're currently using (if GShutdown fails to detect them) or type in a command to perform before the shutdown procedure begins. Moreover, you can set GShutdown to warn you a few minutes before executing the action, just in case you forget.
Well, I hope this was at least a tiny bit helpful. Now if only the good guys at Canonical would fix the damn PC Speaker bug so the dead won't rise from their graves every time an Ubuntu machine is shut down. But that's another story. :)