When an ASP.NET application launches a watch is put on the web.config file. ASP.NET will detect if the web.config changes while the application is running.
When ASP.NET detects a change it will spin up a new version of the application with the new settings in effect.
Any in process information, such as data kept in Session, Application, and Cache will be lost (assuming session state is InProc and not using a state server or database).