There are drive-by downloads, meaning stuff that can be downloaded onto your computer (often from an infected site or a redirection).This is, from what I understand, one of the most common ways people's computers end up so infected. This is not to say you were deliberately going to infected sites; anyone can end up redirected. For instance, I've been redirected to a rogue antivirus (a type of malware) a few times on Deviantart, a safe site.