Why didn't I get badge name right now?
(even though the badge progress tracker on my user profile or the review stats page indicates that I qualify for the badge; I even got the message "Congratulations - you earned [badge name]")
Most badges (with the exception of the Informed badge) are awarded by scheduled jobs, which are non-deterministic, meaning that there's a percentage chance of a certain badge query running every few minutes. Some badges, such as the Explainer family, have reduced chances of running, and the Beta badge isn't awarded until after a site's private beta finishes.
Additionally, if you cease to qualify for the badge before the badge script runs, you won't earn the badge. For instance, if one of your questions receives a score of 10, but it gets downvoted to 9 before the script runs, you won't earn the Nice Question badge. If the badge is one that can be tracked in the user profile, it may take some time before it once again shows up as a trackable badge.
Note that the badge tracker display in the public profile is loaded live, so it may display a "Congratulations - you've earned [badge]" message before the badge script has run and actually awarded you the badge. That message is simply based on full, live progress to earn the badge, and not based on whether the badge was actually awarded to you or not. Only when you see the badge in the "Badges" subtab of your user profile is when the badge has actually been awarded to you.
Tag badges are based on tag scores, and those are calculated once every day (in the early UTC morning), so tag badges are awarded (and revoked) even less often.
Under extremely rare circumstances, it may be possible for the badge criteria to be faulty. To confirm if this is still the case, wait 24 hours for any scripts to run, then carefully read the exact criteria here and check to see if you still continue to meet them, before filing a bug. To increase the chances that others (including the SE team) will recognize your bug report as a legitimate issue, provide some data of you and other users who should have earned the badge but didn't.
More information can be found here: How long does it take for badges to be awarded? How are they generated?
What are "retired" badges?
Retired badges are those badges that are no longer awarded by the system, either because the feature they are related to was later removed, or because the team has decided that it promotes some type of activity that should no longer be promoted.
Users who earned retired badges will still be able to keep them, but they can no longer be awarded to new users or existing users who haven't. Note that it's still possible to "earn" retired badges by merging an older account with a retired badge into a newer account without it; this is why you may still see them being awarded from time to time.
Some badges may have been fully revoked from all users in addition to ceasing to be awarded - these include the Census badge and the above-mentioned Stack Overflow Documentation badges. However, that happens only in specific exceptional cases - see the above sections for each of those cases - and in each case the full revocation of badges was made up subsequently by a single badge being awarded for past recognition of having earned a revoked badge.