Nowadays, more and more Android users rush to rooting to have more control over settings, features and performance such as getting rid of bloatware, speeding up phone and running high performing apps. However, due to technical incompatibility, human error, misoperations, etc. rooting puts your phone in the risk of being bricked, stuck in a booting loop as well. So here I gather 5 things that you could refer to before rooting, which helps to reduce the risks of rooting.
First of all, note that the detailed rooting process varies with different phone models. Take Samsung Galaxy S5/S4/S3 for example, they have their own model builds although they share the same product line name of Samsung Galaxy. Moreover, some firmware only caters to specific models and installing the wrong firmware can damage your phone for good. So you'd better navigate to Settings >> About Phone to check the model number on your Samsung S5 just as the picture below.
Then look for corresponding and trusted rooting tutorial based on your phone model. Though there're many providers of rooting instructions online, not all of them are credible. As far as I'm concerned, XDA developer's forum is a good choice. It not only provides best custom ROMs and updating discussions but also allows you to post queries for a specific problem.
Generally speaking, rooting an Android device requires you to unlock the bootloader, which would wipe all data on your phone. Hence, it's HIGHLY-RECOMMENDED that you create a backup of all important settings and personal data on your Samsung Galaxy S5/S4/S3 including contacts, messages, pictures, notes and other media files stored in the internal memory.
Just creating a backup of Samsung Galaxy S5/S4/S3 is far from enough, you need to test the backup on the SD card or 3. Create a backup is meaningless if it doesn't work. Sometimes backups can be corrupted, in other words, they would prevent you from loading important data and settings. It's better to be sure than sorry, so test the backup before proceeding with rooting.
After above preparations, make sure that you've downloaded all the drivers and tools recommended in the rooting tutorial and your phone has at least75% of charge left. In addition, read the rooting tutorial, comments and feedbacks carefully to be familiar with the whole process, then you'll be prepared if an unexpected error pops up.
With the preparatory work done, you can start to root your Android device and I bet you would go rather smoothly during the whole process.