Could someone explain to me how exactly an iPhone detects a Wifi hotspot? I mean i want to know the exact working of it. How does it know of all the networks that are present in the location? How often does it check for the networks ?
The 802.11 specification has a standard for Beacon Frames that get sent periodically to broadcast all the details about a particular hotspot.
All Apple hardware for Wi-Fi implements this specification and the radio just has to listen for beacon frames over a period of time and present those options to the software.
I don't have a analysis or trace of the specific chipset within any iPhone, but my experience is that the device joins known networks within a second or so of coming into range of a network that is saved and set to be auto joined. Also, it would clearly start listening for beacon frames as soon as you turned on Wi-Fi from exiting Airplane mode, starting up or waking from sleep.