Does Android continue to run after phone is switched off? I was wondering about this: it seems that when you set an alarm, even if you switch off your smartphone, on reaching that time the alarm manages to ring.

Is the Android framework still running and hence the Alarm Service is able to detect change in time, or other reason?
There was a question here asking if it is an expected behavior, it has two answers saying not much more as simple yes.

I am going to answer this question as a question of why is it so, whether Android is running, and how it works if not.

The answer is: no, Android is not running nowhere, nor is Linux underneath him. Wake up on alarm is a hardware feature which was around a long time and was actually very common a time ago. The feature involves hardware. And because of the associated costs, I think, manufacturers started to implement it less and less. There is quite a lot of expensive phones today, which don't have it.

The alarm clock while power off feature has nothing to do with Android or whatever OS is on the phone. Any device today is never quite completely off. There are always few chips powered. No conspiracy here, those chips in question are well documented power chips, without any special spying powers if that is in question. We can say a phone, or other device, is on if it's processor is on. That can be woken-up by various events, only one of which is the power button. If you plug a charger to a powered off phone, it will power on, determine what's happened, then it shows a battery charging graphics. There is usually separate boot for each such event. One of such could be a signal from an alarm clock. You have phones which shows such alarms while they boot to special alarm clock mode, and then you have phones which will go through normal boot to show alarm in its alarm App.

But it's not just to send the wake signal. Phones offer multiple alarms, you have timezones, silent modes, and there need to be a way to store the alarm value from an alarm app when you set an alarm time into the clock chip. I don't think it's all such a big deal, especially when a basic clock is usually there somewhere anyway, but it's cheaper without it.