Init runs multiple getty to listen on connection (console, network, modem). When a connection comes in, getty display the login prompt to get the userid entered. Getty spawns login program to display the password prompt. User enter password and login checks the credentials. Login then run the shell specified in etc/password for the user.
The first hash shell is launched with login flag on. It execute the /etc/profile which set up the basic environment for everyone. Then it looks into $HOME and execute one of .bash_profile, .bash_login and .profile to set up the personal environment. These files source $HOME/.bashrc. All these files set up environment variables.
When the shell is logged out, ~/.bash_logout is sourced