I just had the case that indeed I HAD to specify my Android device ID.
My intention was to unlock the bootloader of my Android device.
But Ubuntu just did not find the device when in "Download mode" - as displayed on the device screen.
When using like:
fastboot devices
Had no output, just prompt.
As soon as I used just
fastboot -i 0x2e04 devices
it listed the device.
For all my predecessor Androids on the same Ubuntu host optin "-i" wasn't necessary.
2e04 resp. 0x2e04 is the ID for Nokia. In my case Nokia 6.1 or 6 (2018).
Could be found with "lsusb" or "dmesg" like:
saeufer@eckkneipe:~$ lsusb
Bus 002 Device 002: ID 17ef:7214 Lenovo
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 014: ID 2e04:c026
Also mind "fastboot" might need sudo/root permission on default Ubuntu settings.
EDIT/Update
Reason was I had an older Ubuntu (32Bit) and package-manager did not update ADB tools (including also fastboot) to more resent version. I later used a newer Ubuntu (virtual machine) and ADB tolls were a bit more current - no need to use "-i"
option any longer. So if you struggle consider update ADB. Newer 64Bit versions can also be downloaded at Google (I just miss the link). 32Bit ADB tools are deprecated by Google.