Tags are basically keywords you can use to describe posts, allowing you to easily search and explore posts based on their content. Consult the cheat sheet for a full list of what you can search on.
When you're tagging a post, use the following guidelines:
Replace spaces with underscores
For example, maria-sama ga miteru becomes maria-sama_ga_miteru. This small concession makes other features much easier to implement.
The following characters are stripped from tags: commas and semicolons.
This is somewhat complicated. In general, use whatever order the the anime uses. Failing this, use the ordering the character's nationality suggests. This typically means LastName FirstName order for Asian names, and FirstName LastName order for Western names.
But there are exceptions. Some characters use FirstName LastName order despite having Asian-sounding names. Subaru Nakajima is a good example of this (in all official promotional artwork FirstName LastName order is used). There is nothing we can do but shake our heads.
Some characters have a mixture of Asian and Western names. Refer to the source material for these cases. Failing that, the general rule is, use whatever ordering the character's last name suggests. Asuka Langley Soryuu has a Japanese last name, so it would become soryuu_asuka_langley. Akira Ferrari has an Italian last name, so it becomes akira_ferrari. But again, there are exceptions to this like setsuna_f_seiei. You can go ahead and curse the site for not standardizing on FirstName LastName ordering earlier on. It's too late to change the system now.
Use full names
Using full names reduces the chances of collisions. The definitive resource for character names is Anime News Network (note that all their character names use FirstName LastName order).
If you're not sure whether a tag is right or wrong, then post a comment asking for some opinions. There are plenty of obsessive Danbooru fans who will gladly weigh in.
Tags can be typed. Currently there are only three types: artist, character, and copyright.
Artist tags identify the tag as the artist. This doesn't mean the artist of the original copyrighted artwork (for example, you wouldn't use the barasui tag on a picture of Miu drawn by hanaharu_naruko).
When tagging something, you can tell Danbooru that a tag is an artist tag by prefixing it with artist:. For example, tagging something artist:mark tree will tag a post with mark and tree. If the mark tag doesn't already exist, it'll be created with the tag type set to artist.
Character tags identify the tag as a character. They work exactly like artist tags, only you prefix with "character" (or "char").
The copyright type indicates the tag represents an anime, a game, a novel, or some sort of copyrighted setting. Otherwise they work identically to character and artist tags, only you prefix with "copyright" instead (or "copy").
Tag ambiguity is handled much in the same way that Wikipedia handles ambiguity. Users who search for an ambiguous tag are directed to a disambiguation page on the wiki, where they can clarify what they want to search for.
The flag for marking a tag as ambiguous is separate from the type. This means that an artist tag could be marked as ambiguous, for example. To mark a tag as ambiguous, prefix it with "ambiguous".