How Android Custom Recovery roots the phone? I rooted my Samsung Galaxy Note n7000. I performed some acrobatics and booted into the Stock Recovery of my phone and installed a zip that contained Philz CWM 6 Touch custom recovery. How can installing a custom recovery ROOT my phone when I have no idea of the root password? How can the said custom recovery even gain access to protected system level stuff without requiring some authentication etc. in the first place?
As davidgo explains, the recovery is like a separate, very simple operating system that your device boots into. When you boot into recovery mode, Android itself isn't running, so none of the OS-level protections like users and file permissions make any difference. However, the recovery mode does have access to the main filesystem of your phone. It's normal for a recovery to mount that filesystem to apply updates, but when you're rooting your phone, the update you supply just writes a suitable su binary to the correct place with the necessary permissions (i.e. with the suid bit set). Then, when you reboot into Android, the su binary is there and available to use.

If you want to think of it like a PC, it's like booting from a live CD, mounting the root filesystem of the PC, and editing /etc/sudoers or /etc/passwd to give yourself root access. Of course you can do this from a live CD, because the 'real' operating system on the PC isn't running.