What happens internally when ESP8266 goes to deep sleep mode. Is there any official documentation explaining that?
You can see this document https://www.losant.com/blog/making-the-esp8266-low-powered-with-deep-sleep
In summary, ESP8266 supports 3 sleep modes:
Modem-sleep mode is enabled only when ESP8266 connects to a router in station mode, via DTIM beacom mechanism. Within this mode, ESP8266 would wake up periodically, automatically, to handle arriving Beacon.
CPU and system are still on. Hence program that does not require constant network access could still run.
System clock is off and CPU is suspended. No program could run. ESP8266 could be woken up via external GPIO level triggers.
System clock and CPU are off.
ESP8266 could be woken up via
a) a low-level pulse generated on the EXT-RSTB pin via an external IO.
b) timer which is managed by the RTC