Rooting an Android phone gives you more access to the operating system, increasing the level of customization. Since Android phones are so different, there is no single root method that works on all or all versions of the operating system. To get started, you need to download the appropriate program for your model (almost all of them are only available on Windows), enable USB debugging from your phone, and set up USB drivers on your computer. Don't forget to backup your data before starting the operation.
Steps
Method 1 of 4: Root a Samsung Galaxy S / Edge

Step 1. Go to "Settings> About" on the phone
You will find the "Information" item at the bottom of the settings menu.
Note: These steps are written specifically for the Galaxy S7 and S7 Edge models, but they probably work for older Galaxy S as well, as long as you download the correct CF Auto Root file for your phone

Step 2. Press the "Build number" seven times
This will enable developer options on your phone.

Step 3. Go back to "Settings" and press "Developer"
This menu appears after enabling developer mode and contains a number of developer and debug items that are usually hidden.

Step 4. Select "OEM Unlock"
This setting allows the phone to be rooted.

Step 5. Install and open Odin on your computer
This is a program designed specifically for rooting Samsung phones, available only on Windows.
You can use the program to root older models, such as the Galaxy S6, but you need to make sure you download the correct autoroot file

Step 6. Download and install the Samsung ninth USB drivers
This step is required to use the USB debugging options on your computer.

Step 7. Download and extract the Chainfire autoroot file for S7 or S7 Edge.
Right-click on the.zip file and select "Extract". The extracted files will have the extension.tar.md5.
Search the CF Autoroot website for the correct file for your specific model if you're rooting an older Galaxy S phone. Using the correct autoroot file is VERY important for preventing cell phone damage.

Step 8. Press and hold the Power, Home and Volume Down keys on your phone at the same time
After a few moments the mobile will enter Download mode.

Step 9. Connect the phone to the computer via USB while Odin is running and the mobile is in Download mode
After a few minutes, "Added Message" will appear on Odin, indicating that the connection between the program and the mobile phone is working.

Step 10. Click "AP"
You will be asked to search for a file to use.

Step 11. Select the autoroot file you extracted, in.tar.md5 format

Step 12. Press Start
The root operation will begin. Your phone will reboot during the process and then turn on normally when finished.
Method 2 of 4: Root a Nexus

Step 1. Turn on your phone and connect it to your computer via USB

Step 2. Install and open Nexus Root Toolkit on your computer
You can use this program to unlock and root any Nexus device. After launching it, you will be asked for your phone model and Android OS version.

Step 3. Choose your phone model from the drop down menu
Go to "Settings> About phone" on mobile if you have any doubts. You will find the model under "Model Number"

Step 4. Select the version of Android currently running from the second drop-down menu
Go to "Settings> About phone" if in doubt. In the sections "Android version" and "Build number" you will find the information you need

Step 5. Press Apply
A window will open with precise instructions on how to enable USB debugging mode.

Step 6. Open "Settings> About phone" in the mobile
You will find "About phone" at the bottom of the settings page.

Step 7. Press "Build number" seven times
This is the last item on the page. After pressing it seven times, you will see a message notifying you that you have enabled developer mode.

Step 8. Go back to "Settings" and press "Developer"
This item appears in the menu after enabling developer mode and contains a number of developer and debug options that are normally hidden.

Step 9. Press "OK" on "USB Debugging"
The debug permission request will appear for the computer you are connected to.

Step 10. Select "Always authorize this computer" and press "OK"

Step 11. Press "OK" in the Nexus Root Toolkit instruction window
The program will automatically locate the files needed to root your phone.

Step 12. Press "Download + Update All File Dependencies" then press "Continue"
The files will be downloaded and you will return to the main Nexus Root Toolkit interface.

Step 13. Press "Full Driver Installation Guide" to find instructions on how to configure the drivers
The steps depend on the current settings. You will need to uninstall the old drivers if you have connected other Android phones to your computer before doing this, then Nexus Root Toolkit will advise you and allow you to download a suitable driver installation kit for your system.

Step 14. Press "Backup" to save the data you want to keep (optional)
A menu with various backup options will open, where you can choose contacts, SMS or application data. Each button will give you specific instructions on how to back up your data to your computer.

Step 15. Press "Unlock"
This option unlocks the bootloader, allowing you to root the device. Note: This will erase all data on your device, so make sure you have a backup of any items you want to keep.

Step 16. Press "Root"
Nexus Root Toolkit will root the device and automatically install the SuperSU program. At the end of the operation your phone will be rooted!

Step 17. Press "Restore"
A window will open with many recovery options, similar to the backup options. Press each item to restore the backup you just created.
Method 3 of 4: Root a Phone with WinDroid Toolkit

Step 1. Check gid = 75731055 the device compatibility list to make sure you can use WinDroid Toolkit with your phone

Step 2. Connect your phone to your computer via USB

Step 3. Go to "Settings> About phone" on your mobile
"About phone" is the last item on the settings page.

Step 4. Press "Build number" seven times
This is the last item on the page. After pressing it seven times, you will see a message notifying you that you have enabled developer mode.

Step 5. Go back to "Settings" and press "Developer"
This item appears in the menu after enabling developer mode and contains a number of developer and debug options that are normally hidden.

Step 6. Press "OK" on "USB Debugging"
The debug permission request will appear for the computer you are connected to.

Step 7. Select "Always authorize this computer" and press "OK"

Step 8. Download and open WinDroid Toolkit on your computer
Once the program is open, you will be prompted to download ADB if it is not already present on the system.
At the moment this program is only available on Windows

Step 9. Click to download ADB (Android Debug Bridge)
If you have already installed ADB, you will not see this window appear. Once the program is obtained, the list of supported devices will appear.

Step 10. Choose your phone brand
The list will expand to show supported models.

Step 11. Select the model
Once done, Winroot Toolkit will automatically download the recovery image and the appropriate autoroot files. Once the download is complete, you will return to the main program screen.
In the lower left corner you will see the connection status indication. If you lose the connection at any stage of the operation, press "Refresh" at the bottom right to get back online

Step 12. Click the items that appear in the "Unlock Bootloader" column in descending order
The buttons vary depending on the phone you are unlocking (for example "Request Unlock" or "Get Token ID"). WinRoot Toolkit will provide you with instructions on how to prepare your mobile for unlocking.

Step 13. Click "Unlock Bootloader"
Winroot Toolkit will automatically download and run programs to unlock the phone's bootloader.
Unlocking the bootloader deletes the data on the device. Make sure you have a backup of the data you want to keep before completing this step

Step 14. Click the item that appears under the "Flash Recovery" heading
The option name varies based on the phone you are flashing on (for example, "Flash TWRP"). The mobile will automatically reboot into fastboot mode and the recovery images will be installed. At the end of the operation you will be asked to restart the device.

Step 15. Click "Yes" to restart the phone
Winroot Toolkit will do this using ADB.

Step 16. Click "Flash SuperSU" in the "Gain Root" column
A window will appear asking you to confirm that you want to initiate the root operation.

Step 17. Click "Yes"
Winroot Toolkit will automatically transfer the SuperSU autoroot file to your phone and launch it with the recovery image.

Step 18. Install SuperSU from recovery mode
The buttons to do this vary according to the image used. When done, a notification will appear on Winroot Toolkit that the change was successful and that you can restart your phone.
For example, with TRWP recovery, press "Install", then select the SuperSU file and scroll to "Confirm Flash" to enable SuperSU on your phone

Step 19. Restart the phone
The device will boot with the normal Android OS and root access!
Method 4 of 4: Root other Android Phones

Step 1. Search for your phone model on the XDA forums
These forums host many Android developers who create ways to root various phones. Look for "Go to" and click on the brand name of your mobile. Next, search for the pattern to find specific information on how to root.

Step 2. Familiarize yourself with the Android SDK (Software Development Kit) and with tools ADB (Android Debug Bridge).
These programs make use of the command line on your computer and are required to unlock some of the newer phones, such as the HTC 10 or the Moto X Pure.
The Android SDK is also the most used tool to root an Android phone on Mac

Step 3. Root using one-click programs for older models
You can use applications like Towelroot or FramaRoot to root some old phones running Android 4.4 or earlier. Check on these sites if your device model is supported by the programs.
Advice
- Even if your phone is connected to the computer during the operation, it is still a good idea to charge it before starting. If it were to download in the course of root, the software could be damaged.
- Download and run an application that allows you to check if the phone is rooted to be sure that the operation was successful.
Warnings
- Make sure the software you are using is suitable for the model and version of the phone you are trying to modify. An error can cause the operation to fail and potentially break the device.
- Unlocking the bootloader and rooting your phone can void your warranty.
- You may not be able to root some phones. This is especially true for the newer models, so make sure you get the desired result before you try. Otherwise, the consequences can be many and varied, from a simple waste of time to breaking the phone.