The ranger is a hybrid class that mixes the abilities of a warrior with that of a druid, while throwing in considerable skill with the bow. Many of their buffs are similar to those of druids, and they have a very powerful snare that they can use to boost their ability to kite with a bow.
Despite their chain armor, they can work well as light tanks, although they are not as good at generating threat as warriors or paladins. Primarily, they're focused on doing damage either from range or up close with their melee weapons. They level slower because of their hybrid status, and they lack any significant way to dump threat. This combined with their high damage makes them a difficult class to play in raids - if they pull a monster off the tank, they're going to eat dirt.
They have the most potent tracking ability in the game, helping them to find creatures to fight against in the wild. They're at home in the outdoors much like druids are, and most of their soloing they do by snaring a creature and then shooting arrows at it until it flops over dead. In parties, they can serve as backup healers, light tanks and ranged damage on single targets. Provided that they have good equipment, they are excellent in this role.
They are a very challenging class to level, unfortunately, and don't really start to shine until they get to very high level and start to put out much more significant damage. Their melee damage is relatively weak despite their ability to dual wield, but it's still passable enough for them to work as tanks if no other class is available.
Rangers also have damage-over-time spells, group buffs and mobility enhancements that help to make them more desirable for groups. They have some solid damage shield buffs as well, helping to increase overall group damage and threat on the tank. For players looking for a strong damage dealing class with utility and soloability, rangers are a great choice. You just need to put up with the potential for a lot of deaths while you're still learning the class, as kiting with a ranger can be quite challenging, and relies a fair amount on ensuring that your snare doesn't get resisted.
Halflings and Wood Elves are arguably the best choices for rangers, as they both have solid agility and wisdom scores. Humans also make for a good choice, as they have the highest strength of any ranger race.