Most people get their computers infected with spyware/adware by installing Share ware or Free ware programs. The creators of these free programs usually spend a lot of time on their software, and usually think they deserve some money for it. With all the competition out there, its hard to sell your product, so most developers give away there software for free. Or they release a limited free version.
To still make some money of their software, some developers add spyware or adware to their installation packages. These are installed on your computer while you install their free software. They receive a couple of cents, and you end up with an adware/spyware infected computer. Even well respected programs such as Winamp, add adware to the free versions of their software. It is everywhere. It is also not uncommon for a developer to link his software to the spyware, which means that the software you download will not work without the spyware. The best option is to remove the program and scan your computer with a spyware remover.
Not all the free programs out there infect your computer, it is just difficult to see which do and which do not. To tackle that problem its a good idea to install a spyware scanner. A spyware/adware scanner can scan, detect and remove any spyware/adware programs that got installed on your PC. Some of the more intelligent scanners can even scan your computer real time, preventing you from installing the spyware in the first place.