When I change my Di2 cassette, do I have to change settings in the app?
No, you do not have to change any settings after you've changed your cassette. Everything will continue to work just the same as it did before.
The Di2 system does not know which cassette you have installed, and it doesn't really care. Don't believe me? Take your wheel off the bike, and shift the derailleurs. You'll notice that they'll shift exactly the same as before.
Chain length and B-gap
Some things you should look at though, are the chain length and the correct B-gap setting for your derailleur.
Especially if you're installing a climbing-focused cassette with a larger max sprocket, you'll probably want to install a larger chain.
Changing the software settings
I wrote that you don't have to change the settings, and that is entirely true.
However, you can change the cassette or chain ring in the software, if you like. This is done in either the derailleur settings or the synchronized shift settings screen.
Doing so will give you more accurate gear usage data (12-speed Di2), and also make sure that the displayed synchro gear ratios are correct.
Note that when you change the cassette or gear rings, the app sometimes invalidates your synchronized shift settings or resets the bike back to manual mode. If you notice that the bike isn't synchro shifting when it should, double-press the function button to switch back into a synchro mode.