It aids with stability and helps reduce the perceived effect of recoil on subsequent shots. Rather obviously, it also increases the weight of the weapon, though that’s not really a significant concern in most situations.
Some stocks for hunting rifles feature a cheek/jaw rest for sighting, which, if it does what it’s supposed to, will be more comfortable than one without.
Collapsible stocks are, usually, less stable than fixed ones. (I’m going to quickly stress, when I say “less stable”, I really mean that as a comparative value. Even collapsible stocks are vastly more stable than a weapon without any stock.) These can be either telescopic (meaning it collapses down into the weapon), or folding (hinging around to the side or over the top of the weapon.) These are more common on combat weapons that are expected to be carried in tight spaces.
Telescopic stocks can also be adjustable. These might not be fully collapsible, but, in very broad terms, you’re trading some stability for the ability to set the length of the stock exactly where you want it. It’s a comfort issue, which can ultimately be more important.
Detachable stocks are a bit of an oddity. The only ones I can think of off hand are for handguns. But, the basic idea is the same. I suppose the entire M16 family would technically count, since the stock can be replaced, though, you can’t use one without a stock, so it’s not exactly the same thing.
There’s also the stock’s material. Wood and polymer composite stocks are the common choices for fixed stocks. Composite stocks tend to be lighter. But, that’s about the extent of my familiarity with the materials. Wood used to be more durable, but with the advances in plastics, I doubt that’s still true. Also, there’s a huge difference between different woods. I want to say ash or hickory is the common choice, but, honestly, that could be my memory messing with me.
Incidentally, the grip, fore-grip, and stock are collectively referred to as a weapon’s “furniture.” So, if you’ve ever heard of a rifle described as having “wood furniture,” now you know what that means.
With collapsing and adjustable stocks, you’re usually looking at an integral part of the weapon, so the stock will be mostly made from the same materials as the weapon’s frame (either metal or polymers). Often with a more shock absorbent padding on the butt.
You will occasionally see people using a lanyard or shoulder strap as an improvised stock. I don’t have any personal experience with these, but the basic idea is you’re pulling away from your body to generate stability. I suspect they don’t handle recoil as well as an actual stock.