Firstly you have to find out the exact model number, Android version and build of your device. As these separate out many variants of the same device. And mismatch in these variables can brick your phone. It is usually in your Android settings>About Phone section.
Then search google with a keyword "root" for your phone with model number. Ex. "root sony experia z5 5.1.1"
Many results will come up with the instructions step by step. But you have to filter out the trustworthy ones. Like XDA Developers as they have extensive community for support, if you find a youtube video with the exact device being shown. That can be much helpful as well.
Last thing research a lot about, follow the steps and don't forget to ask questions on sites like xda-dev.
Best thing i can recommend is to find a thread on xda-developers and read through the root thread to see what others have experienced. And if they have been successful, follow those steps.