Why does your computer lose battery life while plugged in?

The computer does not always charge whiten its plugged in. Sometimes it is in standby mode even if it is plugged in.