There are many ways spyware / adware can get installed on your computer. Spyware and adware can be acquired

1) When you unknowingly give your permission while downloading/installing applications.

2) During a peer-to-peer (P2P) file transfer or software download.

3) When you click on a deceptive or confusing pop-up.

4) When you install insecure shareware/freeware and P2P applications.

5) When you open e-mails you’re not sure are legitimate (spam mail).

6) When simply visiting certain Web sites.

7) When you accept and receive files when chatting on-line with persons you personally do not know.