Here are oversimplified descriptions of what each of these do
Rooting is like getting Administrator account for computer - you can access other user data and settings. For example, You and your brother share the same computer but you have different logins. He wants you to copy few files from his desktop and e-mail them, but you cannot do that, because you are regular user and have no permissions to access it. It's very similar on android where one application cannot access other application data - you cannot backup it's data, game scores or wifi passwords. But if you have rooted your device, you can do that. Typically you have some "su" (Super User) application (like SuperSU), that manages "su" requests from applications that want more permissions than they are usually allowed. Keep in mind that these requests might also harm your device or privacy, so you should trust applications that ask for root permissions. Well known applications with reasonable functionality are okay to be granted root permissions.
When an application asks for "root" permissions, a popup dialog will come up so you won't miss it when it happens.
A very simple way to explain this - flashing firmware is like reinstalling windows. There are many more things to it, but it's like that. You just install firmware to device and you get set of device drivers, applications, settings and maybe even different UI with it. Some firmwares come with su application and are rooted, some not, so when you flash firmware, you still might need to root it.