[T-Mobile Samsung Galaxy S 5] thisisapoorusernamechoice:
BACKGROUND:

OK this question gets asked every day, by members of varying skill levels, so this is intended to be a one stop guide on how to root, no matter what firmware version you're running. Yes this will trip Knox, no that will have no effect on your phone whatsoever, and there are ways to reset the Knox counter. If worst comes to worst and you need to bring your phone in for warranty and they give you any sort of lip for the Knox counter, tell them Kies broke your phone and they da** well better fix it (worked for me with multiple Samsung devices).

That said, this will root the SM-G900T (T-Mobile Galaxy S5) no matter what version of android you're running. Make sure you read this entire post and understand everything before trying anything.

PREPARATION:

Disclaimer out of the way, now for the fun stuff. First, preparation, you need to download the following files to your PC: Odin 3.11.1 (this is Odin, it flashes stuff to Samsung android phones); twrp-3.0.2-2-klte.img.tar (this is the custom recovery we're going to use). Extract the Odin zip file to your PC's Desktop. Download the file named UPDATE-SuperSU-v2.79-20161211114519.zip somewhere to your phone's internal storage or external SD, doesn't really matter which. Now in your phone's settings, go to About device, scroll down to Build number. Repeatedly tap Build number until your phone tells you Developer options have been turned on. Go back and enter developer options, enable USB debugging and hit OK. At this point you'll want to connect your phone to your PC with USB, just to make sure it actually connects (it should). If not, you can download the USB drivers from here (scroll down to Downloads section), but most likely this won't be necessary. OK prep work done, now we get to actually get started on rooting our phone. Make sure your phone has at least 50% battery, this is always a smart safety step.

STEPS:

Power off the phone. Boot into download mode (hold vol-, home, and power all at once in that order), then hit vol+ to continue

Run Odin (double click the Odin3 v3.11.1.exe file). Click the Options tab, disable the "Auto-Reboot" option and double check that "Re-Partition" option is disabled (it should be by default), this is critical to success

Connect phone via USB. Hit AP button in Odin, select the twrp-3.0.2-2-klte.img.tar

Flash (click start). When it's done, the progress bar will be full and Odin should say "PASS!"

Hold vol+, home, and power (all at once, in that order) to boot into recovery. THIS MUST BE DONE BEFORE REBOOTING NORMALLY!. TWRP might ask if you want to let it modify your system or keep it read only. I would highly recommend you let it modify your system, you might be OK keeping it read only, but I cannot guarantee that. You will be fine letting it modify your system, that I can guarantee.

Hit the install option and navigate to the SuperSU zip file that is saved to your tablet. Select it and swipe to install.

Reboot system (normal reboot). If TWRP should ask you, do not let it install supersu the way it wants to (do not swipe to install, just reboot).

When android is booted, run the superSU app and go into settings, disable the Mount namespace separation option, and reboot immediately.

Please note the first boot might take a while. If after 10 minutes or so the phone has not rebooted, you should boot back into TWRP, install the supersu zip file again, and this time wipe cache and dalvik before rebooting. Otherwise the cache and dalvik wipe is not necessary. I will eventually post pictures to demonstrate all the steps in the 2nd post, and hopefully FAQs or whatever in the third post.

If you want to hit the thanks button that would be awesome, but the real credit goes to chainfire for his amazing work with supersu and really just all things root in general; and Dees_Troy for doing an excellent job developing and maintaining TWRP custom recovery for our device. They're the real heroes, I just wrote up this guide