Somehow if you bricked your device while installing custom ROMs or kernel, you can unbrick it by Installing stock Samsung Galaxy S5 firmware using Odin Flash Tool
And If you want root access after Installing the Custom ROM, you can install TWRP recovery for your device the flash the SuperSu or Magisk via TWRP to get your device rooted.