How is the transfer of an aircraft managed when it landed at a different airport than the scheduled one? The question came to me when my flight could not land at the scheduled airport because of fog. 

We landed in a nearby city (Turin instead of Milan). Is the aircraft transfered without passengers later on? Bear in mind that there are no flights scheduled between the 2 cities (120 Kms distance only).
The aircraft will most probably be re-positioned to wherever it is needed. Often this will mean sending a crew to wherever the aircraft is and having them ferry it empty. If it is some far-flung place, the crew which landed it there may wait until it is possible to re-position it themselves.