I have just bought an android phone and I want to get the latest OS. However, I must root and unlock bootloader and recovery.

I understand that to root something you gain administrative privileges. However, I've seen some drawbacks of doing this.

Can one of you explain what all of this does to my phone and point me in the right direction? 

I am new to this, so it would be much appreciated if you guys could help me on this.