What object is responsible for dipatching the UIViewController
rotation method calls, i.e:
shouldAutorotateToInterfaceOrientation:
How does it know which UIViewController has its view as the subview of the window?
UIViewController class maintains a static map between views and their view controllers. This map is queried in a few key places inside CocoaTouch. In particular, [UIView nextResponder] queries it and returns the controller if found.
I guess UIWindow does the same lookup with its root view to know which controller to forward rotation events to. Will check this next time I'll be looking something up in the disassembly. (I've spent some time reverse-engineering CocoaTouch to understand how things work there.)