The simplest way to animate an avatar is to let the default standard animations do it. When you're bored with that, there's other options.
Flexible prims are great for flowing hair, cloth (skirts, capes, ribbons), wings, tails, tentacles... You don't need scripts to create motion with flexi.
You can currently only make boxes and cylinders flexi, and you can't visually attach anything to the "moving" end of the object. The parameters can be adjusted to simulate many kinds of movement. The fact that linking a flexiprim into an object makes the object phantom ends up being meaningless to attachment-makers. Anything worn is automatically phantom anyway.
All the work for flexible prims is done on the client. They don't add lag to the servers. This also means that there's no guarantee that ribbon is doing the same thing on my screen that it is doing on yours.
Groups of flexi prims can be linked together while moving as one. Here's a flexi tail as an example. It is made of a cone and a pair of flat boxes. The box with the alpha circle texture has been tapered. You can use alpha textures to hide parts of prims you don't want visible. Watch out for alpha glitching - when alpha textures are in front of one another the browser may not know which texture to draw. To keep the pieces moving as one you need three things: The flexi prims must be centered on one another, they all must have the same Z size property, and all their flexi properties must be identical.
For scripters, flexi movement can be enhanced by attaching the prim to another one that either moves/twitches or rotates. Flexi parameters can also be modified using llSetPrimitiveParams(). I've seen an attachment of medusa-hair with "snakes" that would respond to someone standing close to the wearer.
One of the types of inventory in Second Life is animations.
If you want to make animations, you'll need a tool like Poser or the free QAvimator. The animations creation forum is full of information and resources. Here's the SLWiki article on animation. There's a lot of little details you need to know (like the keyframe, how hands work, hip height issues, etc.) Some parts of creating an animation (like looping) can only be done when loading the animation file into SL. Check out the advice from Bloodsong Termagant here.
Animations can be started by hand by clicking on them in inventory. Scripts can be used to trigger them (look at llStartAnimation(), llStopAnimation(), and PERMISSION_TRIGGER_ANIMATION.) The most popular interfaces to scripted animation seem to be speaking a command in chat and HUDs. If you're using a script to animate an avatar, keep in mind that the animation has to be inside the prim with the script unless you're using a default animation. (And yes, that bug has been around a long time.)
Using an animation doesn't change the avatar's bounding box, so if the avatar doesn't fit when standing, crawling isn't going to improve matters. Animations don't change the avatar's position either.
AOs let you control basic animations without the user having to do anything other than wear an attachment. They catch an avatar's animation state and play a specified animation instead of the default one.
WetIkon and ZHAO are two freely available AOs with open scripts that let you pick the animations. Several animators sell themed sets of animations in AOs. There's ones let you walk digigrade, sit and run on all fours like a dog, and stumble around like a zombie. Many prim shoes include AOs so that avatars wearing them have custom walks. I've seen some interesting animations used with wings. Some have the base avatar flap their arms, but I saw one where the wings attached to the avatar's shoulders and the shoulders were animated to move up and down making the wings flap.
If you're scripting something to override default animations, you want to spend time researching. Some kinds of animations are linked to events (moving_start and the like) while others require timer-based scans to see what the avatar is doing. Take a look at llTakeControls(); it is usually used for vehicles but I've seen it used with avatar-animating attachments in games.
Some kinds of avatar require an AO with special animations, which leads us to the next section. The popular Tinies are made by folding the base avatar into a pretzel while leaving the hands, feet, and head in reasonable places. Giant avatars (anywhere from 9 to 30 or more meters tall) usually have specialized animations with an AO. Some prim-heavy avatars use an AO to keep the base avatar locked in a position.
There are AOs and there are "mission critical" AOs.
The former are your garden-variety bipedal humanoid walks and stands and sits, that blend imperceptibly (mostly) with the standard animations.
The mission critical AOs are different, the definition of the avatar body heavily relies on the avatar being bent out of shape. This includes quadrupeds, tinies, giant robots, some dragons, etc. It may also apply to AOs that raise the avatar hip height while walking. These need to obliterate the underlying default animations completely. When they do not, the avatar experiences "pop up" ( when you quad goes from pacing on all fours to standing upright, or when your tiny unfolds.)
There's two big tips for making animations for "mission critical" AOs: All animations must be Priority 4, and their ease-in and ease-out must be zero.
Despite the listed priorities of default animations, they often have effective higher priorities. The default animations can have different priorities for different body parts. For example, in turning left or right, the listed priority is 1. However, the hip very definitely has priority 4 in these animations, and will cause no end of heartache trying to use a simple P3 stand or turn in place of it.
Even segueing into these animations with a priority 3 will cause pop up. Walks and stands can be over-ridden with P3 animations, but the transition from standing to walking, or standing to turning will cause pop-up. Bloodsong Termagant reports trying all the variants, mixing P3 and P4 stands and walks and turns, and tweaking the Franimation script to poll faster and slower.... nothing fixes this but to have ALL the animations P4.
According to Rainbow Drake of NCI's class, if ease-in or ease-out are greater than zero, the animation will attempt to 'ease through' the default animations. This will result in popping up at the start and end of your animations. You can try to make your own ease settings in your animation, by having a default stand at the start and end of each animation, then looping the middle.
The direct way to have attachments appear to move is to script them to move. If they're scripted to move, attachments prims either reposition themselves around their root prim or the attachment point. Changing position or rotation isn't the only option; things can change size or shape to simulate motion. Popular uses include making cat ears swivel, a rabbit's nose twitch, and an exposed heart beat.
Animating textures using llSetTextureAnim() is another option. It is used a lot with cyber attachments, and to create blinking eyes when the base avatar's eyes are hidden.
There's two versions of a Beating Heart attachment in the Avatar Toolbox freebies collection. They're both identical except for the animation scripts. The first script shown here is for the one animated by changing the size of the prim with the heart texture. The second is done by animating the heart texture.
Another method is to create an object with prims in all positions, then to alternate what prims are visible. Here's a cat tail that is actually two tails - but only one is visible at a time. llSetAlpha() and llSetLinkAlpha() are commonly used for this.
Fingers and thumb movement aren't controlled by user-createable animations. When uploading a custom animation, the preferred hand morph can be chosen, but there's no guarantee that it will be used reliably.
The shape of the hands can be morphed using some default animations. You can use LLStartAnimation() using a default animation that shapes the hands while also using a higher-priority custom animation to control the rest of the avatar's movements.