If you currently have an iPhone, you most probably have the OS version 3,0.x, 3.1.1, 3.1.2 or 3.1.3. I will show you a way to jailbreak each of these OS versions. If you have upgraded your OS via iTunes in the last day or two, to an iOS 4 version, please see a link at the bottom of this article for further information.
Jailbreak OS 3.1.1 and 3.1.2 using blackra1n
The blackra1n tool is available for both Windows and Mac. It can be used to jailbreak your iPhone if the OS version is 3.1.1 or 3.1.2.
Just go to blackra1n using link in the references section and download the blackra1n tool.
Open it and connect the iPhone to your computer. Click on the "make it ra1n" button.

click to enlarge
This will place your device into recovery mode and start the running blackra1n. Your device will reboot soon. After the reboot, you will see a blackra1n icon on your iPhone menu. Your iPhone is now jailbroken. You will see the option to install the Cydia, Rock or Icy app store on your iPhone. After installing it, just click on uninstall blackra1n to remove that icon.
Jailbreak OS 3.1.2 or 3.1.3 using Spirit
The Spirit tool can be used to jailbreak iPhones running OS version 3.1.2 and 3.1.3.
Just download Spirit using the download link in the references section and extract the tool from the archive.
Run the tool after connecting your iPhone to the computer. After the iPhone is shown connected in the Spirit tool, just click on the Jailbreak button. After the jailbreak is complete, quit the Spirit application.

click to enlarge
The process is similar for both Windows and Mac users.