Back in 2015, LG officially started allowing customers to unlock bootloaders of select LG phones. You would still void your warranty, but you had the option. Now the bootloader for the 'H840' variant of the LG G5 can be officially unlocked.

Unlocking the bootloader involves entering the first 15 digits of the phone's IMEI number into LG's site, installing the Android SDK (or a custom ADB/Fastboot installer, if you prefer), and generating an unlock key. It's a tedious process, but for some, being able to use custom ROMs is worth it.

You can find all the details, as well as a list of all the supported devices, at the source link below.

Source: LG Developer