Hello! You can use TWRP to help you but it will a little complex. One simple and secure way is to use iRoot and root device with only one click. I have tried and won't brick your device. You can follow these steps:
Step 1 : Download iRoot for PC and back up your file
Step 2. Prepare a Windows computer and make sure your phone’s battery is at least 80%.
Step 3. Install Xiaomi driver on your PC. Connect your phone to the PC.
Step 4. Open iRoot and it will automatically scan your device. Click “Connect device”.
Step 5. After detecting, click “Root Now” to start the rooting process with iRoot.
Step 6. After several seconds, your Xiaomi Mi 4 has been rooted.