A software hacker does this in much the same way that network hackers attack network security. They may set up a serial number generator that tries millions of combinations of numbers and letters until it finds one that matches. The hacker could also attack the program at the assembly-code level, finding and altering the security measures. A software hacker is not necessarily a software pirate. A hacker may break the security and use the software, but a true pirate would also replicate and sell the cracked software.
Some hackers are also virus builders.
Viruses, worms, Trojan horses and logic bombs are all forms of programs that can invade a system. Some are malicious, some aren't. A virus is a program that may or may not attach itself to a file and replicate itself. It may or may not corrupt the data of the file it invades. It may or may not try to use all of the computer's processing resources in an attempt to crash the machine.