You can choose the installation location when you start the installation of a new UE install inside the launcher like so:
This thread goes over being able to move UE to a different drive if needed, has a method involving symlinks and one involving redirecting an INI. Both are viable (in windows):
To change the vault cache (marketplace or sample assets store location), in the Epic Games Launcher, open the settings in the bottom left:
Then scroll until you see Edit Vault Cache Location