A virus is a self-replicating application that attaches itself to other executables. Many viruses affect affect the host as soon as they are executed while others lie in wait until a predetermined event or time, before carrying out their task.

Many potential actions can take place including
  • Altering data
  • Infecting other programs
  • Replicating
  • Encrypting itself
  • Transforming itself into another form
  • Altering configuration settings
  • Destroying data
  • Corrupting or destroying hardware

Viruses are not restricted to above actions and can easily perform a wide range of potential activities. The authors of malware are constantly developing and refining their craft.
The process of developing a virus is very methodical. The programmer is concerned with creating an effective virus that can be spread easily.

The life cycle of a virus often follow below steps...

Design
The author envisions and creates the virus. The author may choose to create the virus completely from scratch or use one of the many construction kits that are readily available, to create the virus of choice.

Replication
Once deployed, the new virus spreads through replication: multiplying and then spreading to other systems. How this process takes place depends on the author's original intent; but the process can be very rapid, with new systems becoming affected in short order.

Launch
The virus starts to do what hostile task it was meant to do. Once the virus activates through a user action or other predetermined action, the infection begins.

Detection
The virus is recognized as such after infecting systems for some period of time. During this phase, the nature of the infection is typically reported to antivirus vendors, who begin their initial research into how the virus works and how to eradicate it.

Incorporation
The antivirus vendors determine a way to identify the virus and incorporate the process into their products through updates.

Elimination
Users of the antivirus products incorporate the updates into their systems and eliminate the virus.

This process is not linear; it is a loop or a cycle. And not all users deploy antivirius software.

Why do people create viruses? There are a number of reasons, such as curiosity, hacktivism, showing off, spying, and many others that may or may not make sense to anybody but the developer.