There are 3rd party apps (if your OEM doesn't have the option) to use the display for that. It can mimic a "LED" or something else. It works fairly well, especially on devices with OLED displays (most mid/high end phones).
Problem is they don't actually use just the notification part, they actually illuminate the whole display at the minimum brightness setting, which isn't 0 for third-party applications. You can notice this if you let your eyes adjust to a room with no other lights. The power drain for eight or ten hours of this is more than you'd think. I still use it, but it's definitely not a painless replacement.
On an OLED screen isn’t the minimum brightness setting for each pixel “off”?
On a hardware level, yes. Apps don't actually get to access that. Try it yourself in a pitch-black room. Compare black areas in the OEM's always-on display mode to a third-party AOD app or a fullscreen image viewer showing a #000000 box.
Don't have any OLED Android devices, but on iOS the #000000 box is indistinguishable from off
I tested on my OnePlus 8 Pro running LineageOS and the first app I found on the Play Store (aodNotify) seems to work as expected. Pure black, as if it was part of the "always on display" feature.
I guess it could work differently on different Android "flavours".
Interesting. I also use aodNotify and on my S20 FE it illuminates the whole screen.