There are multiple ways to do this:
The first and the most popular way is to create a skeleton for the model, then use this skeleton to move around the vertices of it. This is also usually done by the artist, because it needs to contain what areas are affected by which bone.
When the animation is done the artist saves it in a file (for example the COLLADA file format is very popular between beginner game programmers, because it is readable by humans, but because it's based on XML, it's big, so bigger game companies use files like .fbx).
The skeleton is made out if bones. The artist can define which vertices need to be moved by giving them a weight. The higher the weight, the higher the amount of movement it produces when the specific bone is moved. There's a separate weight table for each bone, so the same vertex can be affected by multiple bones
The second way is called morphing. It's more ancient but is still used today, because it doesn't require the use of a skeleton, thus it's better for things like the face of a model, or when you need to move the separate vertices around. Instead of creating a skeleton, the artist creates the states the model can be in, then the program loads in each frame and interpolates between them in the vertex shader.
Literally any model format is able to store an animation this way in the form of multiple separate files (like in .obj files), but some are able to handle them natively inside 1 file (one of the most famous one between beginners is id Software's .md2 format).
The third method of animating something is called procedural animation. It's not widely used, because it doesn't result in humane movements. It can be used when animating water or grass or any other natural objects, that has a pattern in it's motion.
The fourth and arguably the most complex is muscle-based animations. For example GTA IV used this engine, which calculates motion using a defensive AI and a skeleton structure. It's based on the first technique but it doesn't require the artist to animate the body. It's kind of like ragdoll but with better motions.
The fifth way is ragdoll. You probably know this, there are even games which almost purely rely on this, like the infamous Goat Simulator, but most games use it for dead characters. This also requires the artist to create a skeleton, but moving the joints is done with algorithms. These algorithms take max angles and drag into consideration.