depends on the model, if it's a white macbook its probabbly the ribbon cable (visible under the battery) acting up, you can usually wedge something between the battery and the cable to keep it in place.