Comment: I'm not a native English speaker and I'm not working in the electronics industry for quite some time, so excuse if some technical terms are not on the spot or grammatically properly written.
Why do they still work?
Well, simplistic said, because for the electric all seems normal. The water might not be in areas where it can cause havoc (because of measures taken not explained here). However, for simplicity lets assume, we have an area with corrosion that might potentially create issues.
The majority of parts - in view of their count - on a PCB (Printed Circuit Board) are usually passive ones. For example these are resistors and condensators. Almost all rectangle shaped parts on your example picture should be condensators (size 1206 down to 0402 Imperial, I assume - more on Wikipedia). As you can see, there are open solder points (they don't seem to be lacquered). If water comes in this area and corrosion happens, you might get either a electrical bridge between these contacts or the solder point might corrode, resulting in a reduced electrical conductivity.
Resistors are often used to prevent other circuits - often controllers - from getting too high voltages at their inputs. Condensators then are commonly used to "smooth out" the voltage or to work as a buffer of some sort. There are (way) more use cases for both of them, but I want to emphasize these because they're important for our context.
Now, the actual "heart" of almost every electronic device is of course a microcontroller of some sort. We want to protect them with all reasonable effort because if they fail, the device might get unusable (or even destroyed). So all other parts (way more than I stated above) around trying to supply them with the required signals, so they can execute the code that's running on them in the expected way.
Shutdown reason 1: Unsteady voltage supply
Now, assume for example, we have a corrosion issue in an area that's responsible for the voltage supply of some of our micro-controllers (i.e. in a phone). Also assume, condensators are affected that should supply controllers with a clean, smooth direct current. However, because of the corrosion they don't work as expected anymore. They might still have contact but not as the manufacturer expected it. The result will be a more unsteady voltage supply for the controller. If the voltage drops are big enough, the controller might be forced to switch down and subsequently the phone might get turned off.
Shutdown reason 2: Overvoltage protection
Extend the thought from the example above, but this time assume the affected parts are resistors. The effect on the electrical connectivity is the same. However, we assume that the electrical circuit is designed in a way (resistor network) that a voltage greater than expected comes to the controller. Ideally, the controller will be able to handle the full operating voltage at least for a short time. To prevent further damage, it might turn off itself and the device after that (ofc good design recommends there should be something logged then, although you as customer might not able to get to it).
Shutdown reason 3: Overcurrent protection
Similar to overvoltage in principle. However, now assume we have a "classical" short circuit between two or more pins of a controller. Often, that's not necessarily an issue because some pins might not even be connected for example. However, if you're connecting the "right" two pins - most notably the power supply - you should hope, the controller has a proper overcurrent protection. Most likely it will turn off itself when noticing a short circuit there and turn the device off after that. Or you might have luck and a fuse gets tripped fast enough to prevent further damage (unfortunately, not a lot of consumer devices have changeable fuses).
Shutdown reason 4: Overtemperature protection
Again, the assumption is similar to the previous ones. A temperature is often derived with specific resistors that change their resistance when the temperature changes. With old computer power supplies this was often done with NTCs for example, actual ones are more sophisticated. Anyway, we're calculating the temperature in some way or another. Now, when electrical connectivity issues are happening, we might get wrong or implausible signals. To prevent further damage (and because the controller usually will go the safe route), the device might shut down. Of course, there also might be real temperature issues in such cases, but you should find that out relatively easily (at least with phones).
I would go on and explain what are commonly used techniques to avoid these failures but I feel for the moment, it should suffice as an answer to your question.