quite a lot of ways really most common being getting a strange message from pop ups over the internet or they can come from competitions eg. apples 'how many triangles?' and trying to open it - this may give you the virus
from a website (use anti virus and anti spyware) from an email (let the anti virus scan your emails) from a pen drive/usb drive (scan with anti virus) from an infected cd/dvd (use threat fire) from...