Need help in figuring out why my MacBook (mid 2012) crashes even after reinstalling ElCapitan
When you have spontaneous problems with your Mac, there are several things you can try to resolve the issue (listed in order of increasing difficulty):


Reset SMC
Reset PRAM/NVRAM
Swap out memory modules*
Swap out hard drive*


The SMC (System Management Controller) handles a lot of low-level system components. Fan issues, power issues, or spontaneous program unresponsiveness can occur if SMC is having problems.

NVRAM (Non-Volatile Random-Access Memory, or PRAM in older Macs) stores system settings that the Mac needs to access quickly. Resetting it doesn't always fix anything you are describing above, but it also never hurts to try it as part of your troubleshooting.

If you have a bad memory module, you'll get weird crashes and system hangs. If you have multiple chips installed (e.g. two 8 GB modules) try removing one, then if no issues, switch and run the system with the other chip for a while. Possible that only one of the two is bad.

If your hard drive is bad, you'll get periodic problems and unpredictable behavior. Unfortunately, a bad hard drive can also mean lost user data... so hopefully you have backups if your drive turns out to be the problem.

(*For those with newer Macs - swapping out memory or hard drives is obviously not a possibility if they're soldered to the system board.)