This is likely the same problem I saw reported countless times. However, mine comes with a twist, so I wonder if anyone can provide extra insight. Briefly, my laptop randomly shuts down (I think it happens only on battery). It's an early 2011 17" version running the latest macOS.
A few weeks ago I reinstalled the whole macOS after it wouldn't turn on anymore. I thought it might've been a hardware issue as many people suggest replacing the motherboard, but I was still able to boot it in the safe mode, which would suggest it's a software component issue.
Fast-forward and it's started happening again, although only infrequently and I am able to turn it back on very quickly if I have a charger nearby. Now, here are 2 insights I noticed and wonder if anyone can explain futher.
1/ Once the laptop "dies", I usually need to connect it to the charger to start it again. It feels like giving it some juice to power up. The battery level doesn't seem to play a role here (happens on 90% too). Sometimes if I connect the charger, turn it on, remove charger, it dies instantly. As if I had to keep the charger in for a certain amount of time until it feels confident to run without it. Feels like teaching a child ride a bike.
2/ Lately, I developed a new theory that it happens only when discharging AND I have to have the laptop on my lap, bed, or other unstable surface. I am paying attention now if it happens again when I work on desk, I couldn't replicate it so far. It's this point that drives me crazy, wondering what it could be.
Any experience with this issue is welcome. 😸
[UPDATE]: I removed case from the Macbook, dusted it off a bit and since then it's been running without any issues again. I haven't changed any settings or components. Computers are weird.