Apple recently released the Beta of iOS 4.1 along with SDK for iPhone4, iPhone 3GS, iPhone 3G and iPod touch. The iOS 4.1 is only available to developers for download. The members which are enrolled in iPhone Developer Standard or Enterprise Program can have an access this by signing into Apple Developer Connection.
iOS 4.1 Beta and SDK can be downloaded here.
UPDATE 1: DO NOT update to iOS 4.1 if you rely on an unlock. Doing so will lock your device. You can jailbreak iOS 4.1 Beta on iPhone 3G (which doesn’t rely on carrier unlock, and iPod touch 2G (non-MC model) using Redsn0w 0.9.5b5-5. Follow the guide posted here to jailbreak iOS 4.1 on iPhone 3G, and here to jailbreak iPod touch 2G (non-MC model).