The answer is already contained in your question. When a terminal is disconnected, the kernel sends SIGHUP to the controlling process of the terminal¹. For a terminal created by a driver in the kernel, the terminal is disconnected when the driver says so. For a pseudoterminal, the terminal is disconnected when the file handle for the master side of the terminal is closed (either because the terminal emulator process closed it explicitly or because the terminal emulator process died)³.
¹ The controlling process is whatever process ran first in the terminal — more precisely, it's the first process that either opened the terminal while being a session leader or became a session leader while having the terminal open, if this process still is a session leader.
² The master side is the side of the emulator. The slave side is the side of the application running in the terminal.
³ If more than one process has the master side of the terminal open, they must all close their file descriptors (possibly by dying), so that the file descriptor is closed.