The iPad and the screen contents are entirely composited. The iPad is mostly a green screen prop with a green screen background. The iPad was 3d modeled (or done using animations in After Effects) and the hands were aligned to the actions on the screen.
This is how they achieve animating the iPad’s freeform movement and perfect lighting since they only record the hands over green screen.