Should something go wrong, it is your own responsibility, so proceed with caution. Although rooting is not illegal to perform on your own device, it can and will void the warranty on your device. These abilities allow you and your installed apps to perform actions on your device that can prove detrimental to your device. These techniques give you permissions to perform actions on your device that are not otherwise possible.
Legal Disclaimer: Root and JailBreak are an advanced technique within Android and iOS.