If you are being asked to click on a popup or install something via a popup... DON'T, (unless you know for a fact it is a legit program). Don't click on any part of the popup. Close it by hitting the Alt key and the F4 key at the same time.(Alt + F4 will close the active window)
Free stuff on the internet is often times carrying a trojan malware, spyware, adware, etc. Again unless you know for a fact that a file is clean I recommend not using or opening it.
Lastly, bad programs are also spread via social networks and email. If you get a message from somebody in your email or via a social network like facebook that contains an attachment or a link to a website, verify with the person that sent it to you that what they sent is legit. Often times someone is unaware their computer has been infected and they are sending junkware without knowing it.