How Repairing and Mending Works
Repairing is a secondary skill used for fixing all items except clothing. Mending is a primary skill used for fixing clothing. For more on skills see this page.
To repair or mend an item, select it in your inventory, choose the "Actions" button in the bottom right, then the "Repair" option on the left. Verify you have the necessary items in your inventory to effect the repair, and click "Repair" in the bottom right corner. If you have more than one tool that could be used for the repair, it will let you select which one you want to use.
Tools that are used to repair or mend items will lose condition every time they're used, even if the repair fails.
If the repair fails, the item you were repairing remains unaffected, however you lose the items you were trying to repair it with. This applies when repairing crafted items as well.