The most common reason for this is a loose battery. If your battery appears to be properly connected, try removing and reseating it. If that doesn't help, you probably have a fault somewhere, either with the battery or some other hardware connected to it. If this turns out to be the case you'll need to take it in for repairs. Hopefully, it's either a dead or loose battery and not a problem with the computer.