Whether you made a mistake when setting it or you've been mind-wiped by aliens sometimes you just can't remember the PIN number or unlock pattern for your phone. Here are your options for getting back into your device.
Option One: Google's Official Method
Luckily, Android has a failsafe built-in. All you need to do is enter your passcode incorrectly five times. Once you do, you should see a new button pop up on the bottom of your screen that says "Forgot Passcode" (or something similar. Then, you should just be able to enter the Google credentials of the account attached to your phone and it'll prompt you to create a new passcode. Make sure you remember it this time -- maybe even write it down and hide it -- and you should be good to go. Of course, this assumes you remember your Google password, so it won't work for breaking into someone else's phone, nor will it work if you have full-blown amnesia. Sorry.
Option Two: Screen Lock Bypass
Unfortunately, the official Google method has been known to have some serious problems in the past -- like, not working at all. If you find that this still doesn't let you into your device, you have another option. Free app Screen Lock Bypass will bypass your phone's lock screen every time you turn it on, so you don't need to type in your passcode anymore. However, it doesn't disable the passcode, it just bypasses it. We wouldn't recommend it as a long term solution, but you can use it to get back into your device and back up your apps before wiping it clean.
Just log into the Android Market's web interface and install the app to your device. Then, install one more app—it doesn't matter what app -- and Screen Lock Bypass will automatically launch, letting you wake up your phone without a lock screen. It'll also launch itself whenever you reboot your phone, so you can turn your phone off and still access your data. Once again, you'll need your Google credentials to log into the web-based market, so evildoers and amnesiacs will not be able to use this method.
If you uninstall it, you'll have to deal with the lock pattern again, though, so like I said -- now would be a good idea to back up your apps and wipe your phone.