1) In the rc*.d folder, all the symlinks are executed according to the number in the symlink name.
For example:
S16openvpn
S19postgresql
...
S23ntp
...
Here S16 will be executed first, than S19, and so on. Please also take in the account that during boot-up all services from the previous runlevel (/etc/rc2.d) are already started (usually runlevels are started consequently during boot-up).
2) Each LSB script has a header describing runlevel and dependencies.
In this case, the 'SXXyyy' in the rc*.d folder is a symlink to the script in the /etc/init.d folder. If you display the script contents, you can immediately see the LSB header with all details about dependencies and runlevels. Something like the following:
### BEGIN INIT INFO
# Provides: pulseaudio esound
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: udev NetworkManager
# Should-Stop: udev NetworkManager
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: Start the PulseAudio sound server
# Description: System mode startup script for
# the PulseAudio sound server.
### END INIT INFO
Each time you run update-rc.d, it checks LSB-headers in all the scripts (from /etc/init.d) and places S and K symlinks to the needed rc*.d folders, according to Default-Start and Default-Stop lines of the header.
Please also see:
https://wiki.debian.org/LSBInitScripts
https://www.debian.org/doc/manuals/debian-reference/ch03.en.html#_sysv_style_init
https://superuser.com/questions/308735/why-do-scripts-beginning-with-an-s-exist-in-etc-rc-d-rc0-6-d
https://unix.stackexchange.com/questions/82379/when-running-to-a-run-level-does-it-execute-previous-run-levels