How to select a rim?
Simple question, long answer requiring a book to cover it fully. Here is my attempt at the introduction chapter.
The biggest concern for most people selecting a rim would have to be total cost of the rim built into a wheel. You have to consider the cost of spokes and wheel building.  In all but the high cost product range it is often cheaper to buy an entire wheel then buy a rim and have it build up to a wheel. The new wheel does not have to match an existing one, apart from cosmetics, its OK to have different rims and spoke counts on the front and back of a bike.
Once it has been decided to buy a rim and build it into a wheel, you will need to select the correct size for the bike you are fitting it to. The diameter chosen will usually be the size the frame builder designed the bike for, however it is possible to go up and down under limited circumstances.  If the brakes are disc, you can go smaller, but risk lowering the bottom bracket too much. Smaller rims may be compensated for by wider tires, some mountain bikes are sold that will take a 650B+ wheel and tire, or a 29&quot; wheel+tire. Larger rims can some times be fitted to bikes not designed for it, but you run the risk of not having enough room depending on tire size, so should be done with caution.  If the bike has V or canti brakes, changing rim sizes may still be possible, requiring new brakes, but is probably best avoided.
The tire width you want to run will determine the ideal rim wide, but there is quite a lot of room for wider and narrow tires and a lot of overlap with rim widths, so this will probably not limit choices.
If you run disk brakes, any rim will be good. if you are running rim brakes, you need a rim with a brake track.
Once you have sorted the rim size, you need to match this to the hub you will use. Pretty much all that has to match here is a hub that fits the bike and has the same number of holes as the rim.  If you are buying a new hub as well as rim, you need to chose the spoke count. Some people get hung up on this, but always keep in mind a well build 24spoke wheel will be stronger than a poorly build 36 spoke.  Choose more spokes (32 or 36) for heavier riders and hard duties like tourers, cargo and down hill mountain bikes. Choose fewer spokes if you prefer lighter wheels and the look, and you are riding smoother surfaces.
At the same price point you may need to decide between a lighter rim or a stronger rim. Look at things like double wall and eyelets. In all but the cheapest rims (when you would be buying a made up wheel) the rim will be build for  a purpose, and be strong enough for the purpose. Double wall and eyelets are a given at a price point its worth buying a rim on its own, so you are looking at weight vs strength.
Finally you have a choice of material - I'll limit it to carbon vs alloy.  Here you need to decide if the extra cost of carbon is worth the weight saving and performance benefits, While cheap carbon can be lower cost than brand named high quality alloy, I would caution buying cheap carbon on such a safety critical part of the bike. This is probably decided by the answering the cost question.
If you plan to reuse a hub and spokes (not recommended) you will need to match the Effective Rim Diameter (ERD) of new and old rims.