Examining the WordPress Core, Plugin and Theme Update Procedure

A few weeks ago I got curious to examine exactly how WordPress Core, plugins and themes are update. You know the drill from a user point of view. You get the update notification in your admin, you click update and everything is updated painlessly (usually). But what exactly is happening behind the scenes?