Most personal computers are now connected to the Internet and to local area networks, facilitating the spread of malicious code. Today's viruses may also take advantage of network services such as the World Wide Web, e-mail, Instant Messaging, and file sharing systems to spread.
In order to replicate itself, a virus must be permitted to execute code and write to memory. For this reason, many viruses attach themselves to executable files (like leeches) that may be part of legitimate programs. If a user attempts to launch an infected program, the virus' code may be executed simultaneously.
More Virus Info: How do I get computer virus?