At the expense of repeating the obvious, use Google. There's at least two different software packages that can be used to help jailbreak an iPhone. Limera1n and redsn0w. As for the actual procedures, you'll have to Google it since I have not bothered to jailbreak any of my iPhone 4's.