Everyone's heard it a thousand times over, and I'm sure many are sick of hearing it.
But why does it help? Surely a computer will just do the same thing again next time?
Here are a few good reasons why it really should be the first thing tried.
Software Engineering and programming in general isn't easy. It's FAR easier than it used to be, and computers are far more forgiving of bad code/syntax. These days you could hand someone without any programming experience a basic program and with a little imagination they'll likely understand what it does.
The downside to making code more person-friendly, is that it's less like how the computer actually sees and runs it. A complicated program (which includes just about everything you use daily, very few "simple" programs are actually useful to a consumer today) often has issues and conflicts within itself, which is what updates/patches are for, to (hopefully) reduce these.
Let's say that the code on the left is run, in conjunction with another piece of code that automatically types "Madrid" each time, and yet another piece of code that says "keep asking until someone gets it right". The computer would keep asking, answering, then asking again indefinitely, slowing other processes down as it's stuck in a loop!
Loops are just one example of code issues that can slow a computer down/cause other issues. Modern operating systems are better at handling these issues, but of course nothing is perfect.
A restart kills those processes, and so "fixes" the problem.
Caching and RAM (Memory)
Computers store a LOT of files temporarily in places that can be accessed easily. Think of it like having an empty desk when you first start up your computer, then do a few different things, leaving papers around the place, watch a YouTube video, that sits at the corner of the desk, ready to be watched again to save re-loading, then 6 word documents are opened and left around the desk. It's a mess. Restarting your computer allows it to "forget" those pages/files etc, and clears it's "desk" for more tasks.
Modern operating systems are quite good at throwing out the old stuff (or filing it as they go) but sometimes applications aren't dropped from memory due to one thing or another, and so just sit there taking valuable resources it could be using for other things. It's a bit like a BIG folder sitting on your desk, leaving only a small corner to do the actual work you want to on!
Restarting files away whatever is on the desk, and throws away what wasn't saved.
Drivers and Settings Issues
"Drivers" are the translators/interpreters that allow your hardware (Processors, Graphics/Network/WiFi Cards, etc etc) to talk to the software (Windows/Chrome/Office etc). As you can imagine, when the interpreters stop working or get things wrong, it can cause all sorts of issues. Sometimes these drivers get it SO wrong that they stop working altogether, and the software/hardware just have to get on with whatever they were doing the best they can (or in most cases, fall to a backup, generic interpreter that, in this metaphor, knows a little of each language, enough to get by).
Restarting your device wakes drivers up again, gives them a fresh start and restores their metaphorical confidence, allowing software and hardware to get on with everything they need to efficiently.
Magic
Hogwarts gets restarted once a week & if Sauron performed a power cycle once in a while he might have noticed the hobbits sneaking in.
Sometimes the hamster running the wheel inside your computer just needs a rest.
Magic. Just magic.
Others
There are plenty of reasons why it might help, but it almost never hurts to do a restart.
I never mind asking people to try it, but I DO worry that people see it as a "cop-out" solution, even though it's always the best thing to try before potentially wasting time doing anything else.
That said, if the same issue arises often, even with regular restarts, there's definitely a problem, and we move onto proper diagnosis.