How do I enable SSH server on startup through Terminal?
The short answer on how to enable sshd from the terminal is doing this:

sudo systemsetup -setremotelogin on


The long answer on how to execute daemons or scripts on startup is a bit longer. There are two ways (that I know of) to do this:


The first one is through Startup Items, which are executed at the final phase of bootup, these are deprecated and shouldn't be used unless you need compatibility with Mac OS X 10.3 or earlier. You can take a look at how to do it this way in here.
The second one is launchd, a replacement for init and rc (among others). This is the recommended way and it's a bit trickier than just putting a script on a folder like in Linux. There are several ways to launch daemons, the preferred way it to launch them on demand (so they will be ready to launch but you won't see them in a ps for example, unless you are using them). The explanation is a bit lengthly and the list of options is long, you can take a look at the documentation here. You can take a look in /Library/LaunchAgents for examples, if you have Chrome installed, there is a file in there for the Google Software Updater called com.google.keystone.agent.plist, that runs at load time, you can start there.