Does it get past the bios and then turns off, does it pass the loading screen and turns off? Or does it do it at random?
Check cables, conections. Remove any external stuff.
Can U get in bios? (del key or f2 key on startup)
Can U get in safe mode or disable automatic restart to see if U get a bluescreen? (press a few times f8 on startup)
Check temperatures and fan (dust)
Do you hear any weir noises? (Can U hear any beep codes from the bios?)
Could be several things, power supply, motherboard, RAM. Usually if it does not turn on at all, power supply would be the first thing to replace. Also check the motherboard for bad capacitors, depending on the age of the computer it could very well have popped capacitors.