We'll first you should get a good clear knowledge of the parts of the computer, and the ability to detirmine if something is a hardware problem or a software problem.
From your example:
If the computer just randomly shuts off, you need to detirmine if it is a hardware issue or a software issue. The best way is to try and re-create what happend. Bying going into the system properties, you can disable Windows from restarting upon a system crash, such as a blue screen of death. If the blue screen occurs, then it is a software error. Another way to detirmine is by checking the Event Viewer.
Now, if it turns out to be hardware problems you would probably start with the obvious problems. My first guess would be overheating, or power. New motherboards tend to shut off if the processor gets too hot, just in case. That, or a bad power supply. I would double check all the cables and make sure the hard drive isn't at the end of a look of 3 or 4 Y-cables.
Also, software errors, can be caused by faulty hardware. Such as bad RAM. So if you had a blue screen of death, you would want to double check your memory with Memtest86+. And then check your hard drive possibly.