That fantastic new Android phone has an open source operating system, but that doesn't actually make the whole thing open. You see, phone carriers and device manufacturers actually put quite a few modifications and restrictions on your phone. Even Google put restrictions into its own operating system - for safety and security, but also at the request of carriers and phone manufacturers.
What exactly is "rooting" in the first place?
On a basic level, rooting an Android phone means giving yourself superuser access. What does that mean? If you use a desktop computer that allows multiple user accounts, some of those user accounts have more power than others, right? Administrative accounts allow you to do more, and they're also a little more dangerous - because they allow you to do more. A superuser account on Android is sort of like that administrator account. It allows more access to the operating system. That means more power, but it also means more potential for damage.
This is to say that phone carriers and even Google is treating you a little like a small child. Don't get me wrong. We are a little like small children when it comes to using our phones, and our lives are generally better for being treated that way. If you had unfettered access to the source code behind your phone, could you guarantee that you wouldn't type in an extra space or delete a line and accidentally crash the whole phone operating system? What if you install a malicious app that completely bricks your phone? Well, lucky for you, you don't have that access. Your user account isn't logged in as root, so all your apps only have permission to play sandboxed areas.
Now, I'm going to turn around and tell you the exact opposite thing. Well, not exactly. I'm not saying rooting is for everyone. It isn't. It involves hacking your phone and risks that you will break it. However, for some people, rooting is practically a requirement. Maybe you don't want to be treated like a child. Rooting your phone gives you total control. You can "flash" variations of the Android operating system that may be more convenient. You can get apps that allow you to have super-powers and do things that the phone carriers and phone makers wouldn't ordinarily allow you to do. Some of those things are perfectly fine, and some may be a bit questionable ethically or legally, so be a good judge. That's what grownups do.
Believe it or not, Google is pretty cool with this whole rooting thing. They could make rooting harder. Lots of Android phone makers did. You can find tons of apps designed to run on rooted Android devices in the Google Play store. If Google were out to quash rooting, that would not be the case. While I can't guarantee any particular app is safe or wise, if you're going to install root access apps, sticking to the Google Play store is at least a way to keep out most of the bad actors.
What are the consequences of rooting your phone? Well, you're going to void your warranty. You might also break your phone permanently. You are also now in charge of keeping track of your own Android maintenance. Any system updates are now your own responsibility.
Obviously I'm not a lawyer, but rooting your phone appears to be legal in the US - for now. However, ulocking your phone is not, provided that you purchased that phone after January 1, 2013. What is the difference? Unlocking your phone means that you are changing it in a way to make it interoperable on another carrier. You obviously can't do that with every carrier - different phones use different wireless communication systems, but if you wanted to take your AT&T phone over to T-Mobile, the courts now say you need AT&T's permission to do that. Some methods to root phones may also unlock them, so be aware and don't inadvertently break the law.