We all forget passwords, type them incorrectly and misplace them. When your encrypted wallet.dat file may contain a very large amount of coins, your password could be worth thousands of BTC.
Encrypting your wallet.dat file is the number one thing you should do followed immediately by making a dual paper copy of your password/passphrase and storing it somewhere safe. Next you should make a backup of your wallet.dat file as well as making a paper copy.
Sometimes though we may mistype when we are creating our encrypted wallet and no matter what we do we can no longer get into our Bitcoins. There is a great discussion on the bitcoin forum with some software help if you find that the password you have no longer seems to work on your wallet.