Explain Idle, Sleep, Stop and Standby modes of power consumption in a microcontroller with examples
Yes, &quot;reading data from a sensor is an instruction which the CPU needs to execute&quot;.  But the sensor can do other work while the CPU is stopped.  For example, the ADC peripheral can do the conversion (i.e. sampling the analog signal and converting it to bits).
The ADC peripheral is powered with a different clock than the CPU.  The ADC clock is not stopped in Idle Mode so that the ADC can continue to work while the CPU clock is stopped.
When the ADC conversion is complete, the ADC peripheral will interrupt the CPU and wake it up.  Then the CPU can execute instructions to read the sample value from the ADC peripheral.
The different power levels such as Idle, Sleep, and Standby correspond to different sets of internal clocks which are enabled/disabled.  Consult the microcontroller's reference manual for details.