There are two ways. You can take them to an NPC that has a dialog option to repair items (most merchants with a fixed shop position, and the wandering caravan merchants), or you can repair them yourself if you have points in the repair skill.
If you use an NPC, you first select the dialog option to have them repair your items. When the item list comes up, position your mouse cursor over the item you want repaired, check the price the NPC will charge, then press the R key.
To repair items yourself, you must have an item of the same class to use as spare parts. Open up your Pip-Boy to the Items tab, position the mouse over the item you want, and press the R key. If you have a sufficient repair skill level, and if you have at least one item of the same class, you will get a repair screen that shows a list of items from top to bottom. The item to be repaired is displayed at the top of the list, with a graph showing its condition to the immediate right. Any other items that can be used as spare parts to improve the top item are shown underneath. Click on any of the lower items to repair the main item. You may keep clicking until the item is completely repaired, until you run out of spare parts, or until your repair skill is not high enough to raise the condition of the target item any higher.