How does WiFi work on an aircraft?
The small bulb houses the antenna that provides the satellite communications for the internet link. 

Inside the aircraft several wireless access points provide a WIFI signal to the passenger's equipment. The wireless access points are connected to a central modem which in turn is connected to the transceiver unit. The transceiver uses the rooftop antenna to communicate to a geostationary satellite.



source: dailywireless





source: Flightglobal



The antenna is a small dish or phased array that is aimed at the communication satellite using servo motors and/or electronic beam steering. The antenna control system receives information about the position and attitude of the aircraft to calculate the relative position to the geostationary satellites that provides the internet communications signal. 

There are also systems available on the market that use a ground based network to communicate with the internet. These systems cannot provide global coverage since the aircraft needs to be in line of radio sight of a ground based antenna.