With Apple ID responsible for iCloud, two-step verification, email preferences and basically all Apple Internet services, forgetting your password can be disastrous. Luckily, Apple built in a password reset method that involves only a few simple steps.
If you can't remember or don't have access to your Apple ID password, say when adding a trusted device or managing account preferences, first visit the Apple ID webpage on a Mac or PC. Click on the blue Reset your password link just below the "Manage your Apple ID button."
For users with two-step verification disabled, enter the email associated with your account on the next page and tap Next. If you don't remember your Apple ID, just click on Forgot your Apple ID? link. If you have two-step verification enabled, you will need access to the Recovery Key assigned to your account as well as a access to a trusted device before continuing. Apple will do away with the Recovery Key system in iOS 9 and OS X 10.11 as the operating systems will feature built-in two-factor authentication.
Following successful entry of your Apple ID (and Recovery Code if required), you will be prompted to verify your identity using either security questions or email authentication. Once your identity has been verified, create a new password. The new password must be one that you have not used in the last 90 days.
Once your new Apple ID password has been created, you will be prompted to enter it on your devices' Settings and/or System Preferences apps to enable iCloud services on that particular device. Some apps, like FaceTime and Find My Friends, require per-app iCloud logins, so you will need to enter your iCloud password specifically for these apps.
Also, if two-step verification is activated, you will need to create new app-specific passwords for apps that do not support the security protocol by signing in to the Apple ID Web interface, selecting the Password and Security menu and clicking on Generate an App-Specific Password. The resulting pop-up window yields a one-time use passcode for entry in an appropriate app's login field.