Awarded immediately after you open the site's tour page while logged in and scroll to the section about badges.
Regular Badges (except "Informed")
A scheduled job; there are a number of scheduled tasks at different intervals (every few (5?) minutes; hourly; daily etc) that do a range of things. Many of the badges are on the "every few minutes" loop...
General rule: Wait at least 24 hours. If you haven't gotten it by then, you probably didn't meet the criteria for the badge. Try checking the list of all badges with full descriptions.
The tag-based badges are calculated on a daily basis at 03:00 UTC, which is when all the tag scores get updated. At that time, any new badges you may have earned will also be awarded, and any badges for which you no longer meet the criteria will be revoked.
Again, if you do not receive the badge at that time, you probably don't meet the criteria. Hover over your score to make sure that your stats for the tag match the requirements. Also keep in mind that a tag must have 100 questions under it before it even qualifies for tag badges.