Samsung's latest flagship smartphone, the Galaxy S5 is yet to go on sale across the globe, but the developers at XDA-Dev forum have already figured out a way to gain root access to the smartphone. The procedure would only work on the international version of the device, which features a Qualcomm Snapdragon 801 chipset. A root solution for the version with an Exynos octa-core processor is yet to come.
Samsung Galaxy S5 can be rooted by flashing the CF-Auto-Root package using Odin. The tool will install SuperSU on your device before restoring the stock recovery to allow you to gain root access on your smartphone in a just a few minutes.
The source link below has the instructions and the necessary tools to root your Galaxy S5. Before continuing please keep in mind that rooting or flashing ROMs involves some risk and would usually void your warranty. So, continue with the process only if you are sure about what you are doing.