I am about to install an OS that may create its own ESP when I already have one. I am wondering which one will be actually used; will the firmware, according to the specification, choose one of them (say the first valid ESP that it finds), or maybe it will read data from both partitions and display it in boot menu?
Without a special file
BOOTX64.EFI in folder
BOOT on the ESP (I assume only the first ESP on a device counts here), most motherboards will not automatically detect bootloaders on the ESP at all, which means moving the drive to another device or resetting the UEFI firmware would cause it not to boot, and after starting the computer once with the device removed, the UEFI boot entry would also be normally gone.
Only one bootloader can occupy this default boot entry. Windows creates a new
BOOT automatically during installation, most Linux installers don't. Run
grub-install --removable to do it afterwards.
For normal UEFI boot entries, which are created during bootloader installation, having the bootloader on a secondary ESP, even if it's on the same drive, is not a problem. At least in my extended experience, which includes very early UEFI implementations.