I'm lazy this is well known, and instead of getting up to switch my mac mini into sleep I wanted to make it sleep remotely so here's how I do it.
Firstly on the remote mac create open terminal, type "nano sleep" press enter this will open the nano editor, type the following two lines
#!/bin/bash
osascript -e 'tell app "Finder" to sleep'
Then press Ctrl-X and enter this will save the file.
Now type "chmod 0700 sleep" and press enter this will allow the file to be executed, when run the computer will sleep.
Ok next we need to connect to the mac remotely, go into preferences then sharing, make sure remote login is checked.
Now back to terminal, type "ssh-keygen -t dsa" and press enter
Press enter when the name comes up.
Type a password and press enter when asked.
This will create two files id_dsa and id_dsa pub.
Type "cd .ssh" press enter.
Type cat "id_dsa.pub >> authorized_keys" and press enter, this will allow the keys to be used to connect.
Finally we need to copy the id_dsa file to the computer you want to use to remotely shut down the mac.
Now on the computer (I'm assuming it's another mac) you need to open terminal, type "nano sleepremote" press enter.
Type the following lines
#!/bin/bash
ssh -i /users/<your>/.ssh/id_dsa <remote>@<remote> -t ./sleep
Replacing <your> with the user on your local computer <remote> with the username of the remote computers user <remote> with the ip address of the remote computer this can also be the name i.e mac.local
Press Ctrl-X and enter
Type "chmod 0700 sleepremote" press enter, this will allow the file to be executed.
Now if you have spotlight enabled you should be able to to access the file via "cmd + space" to open spotlight and type "sleepremote" pressing enter will run the script and sleep the remote computer. The first time it will ask you for the passphrase but this can be stored in your keychain.
To wake the computer again I recommend http://www.readpixel.com/wakeonlan/