Basically, there is a directory called /etc/init.d which contains scripts that are executed on start up. Each script can take the arguments such as "start" "stop" and "restart".
There is also a set directories called /etc/rcN.d, where N is the runlevel. Each directory contains links to the scripts in /etc/init.d that are to be run when that runlevel is entered. If the links start with S, they are started on entry to that runlevel. If the links start with K, they are stopped when that runlevel is entered. The name of each link also contains a number from 1 - 99, which determines the order in which the scripts are run.
I hope this helps