What exactly is superuser.apk and su? I've done a lot of reading into rooting of Android devices. I really want to know exactly what is going on at each step before I commit to the process. 

I'm a little confused as to where the superuser.apk and su files come from. It doesn't look like they are official Google files, but rather files created by a (random) individual. That said, how safe are these files? 

From research, I have a general understanding of their purpose. I was wondering if anyone knew what these files were (executables? scripts?), what they contained and how they generally work.

Thanks!
su (short for Switch User) is a binary executable. It's used by Android and other *nix based systems to allow a process to change the user account it is associated with. The reason it's important from a rooting standpoint is that su without any other parameters will switch to the root user, meaning that processes that require root permission for their functionality need to invoke su (since by default they are not being run by root).

Superuser is an Android application (.apk is an Android application package). It works as a sort of "gatekeeper" to the su binary. Applications which attempt to invoke su will be forced to route through Superuser, which will then prompt the user if it is an unknown or new application. The user then has the option of approving or denying the access to su and optionally having Superuser remember their decision so it can automatically apply it for subsequent calls by that app. By doing this, the only apps which are granted root permissions are ones that the user chooses.

The source of both applications is available on Github, and can be examined/audited by anyone who wishes to look at it (Superuser here, su here).

You can find further details - as well as changelogs - on Superuser's website.

Other related questions on Android Enthusiasts:


How exactly does &quot;root&quot; user access/account works? Do all applications run as root on my phone after rooting?
What are the security disadvantages of rooting an Android phone?
How do I protect my phone from malicious apps once it is rooted?