There are only a few tricks you need to know with spyware; how to execute it on another person's computer, how to hide it, how to collect information, how to send the information back, and how (if necessary) to make it persistent.

How to execute it; the most common method is having a malicious site which gives it to anyone who visits. If you want, you can try to manually distribute it amongst your targets, however it greatly limits your audience but greatly increases the chance to evade detection by anti-virus companies.

How to hide it; this isn't that hard. You just have to figure out how to make your spyware program not have a window or prompt of any sorts. I know that many browser based spywares exist as plugins to your browser which automatically install themselves. Thus, they are always hidden from view, but when you view a webpage, they get to review it first before you see it.

How to collect information; this greatly depends on what you want. If you want to analyze what a person is browsing, browser plugin is easiest. The browser plugin method also works well if you want to collect a person's e-mails inconspicuously. It automatically gets called when the user accesses a webpage. If you want usernames, passwords, you want a key-logger. What most people do is just bundle a key-logger with their spyware and just collect the text files it leaves. In some other cases, you might want a program that collects files or analyzes them from the target's computer, for that you'll need to access files which can be slightly troublesome.

How to send the information back; now this is the tricky part. Your simplest bet would be to send it by email to some address. You could also connect to a specific server you want, and send the info that way, but that's a larger investment for something that will get tracked down anyways.

How do you make it persistent; this is an optional step. The browser plugin method is the simplest here. The browser automatically starts the plugin every time the browser starts up. Other methods would be like setting an auto-run for start-up, but that's kind of obvious.

This is definitely an interesting topic that everyone interested in hacking and programming should look into. Spyware is basically all of the viruses, worms, root-kits, and all that other stuff, just without the payloads.