But how it tackles migration and its own demographic challenges will have tremendous consequences for the U.S. and the rest of the world.