You can only barter with someone if they have a dialogue option to allow it. Most NPCs in the civilized areas will, as will some nonhostile NPCs outside of the civilized areas.
Once you've chosen that dialogue option the barter panel opens up at the top of the screen between your two portraits. You can see what they're offering and add items of your own to your side of the panel. Whether an item is actually part of an offer depends on whether it's highlighted. Clicking an item in one of the bubbles will light or disable the pip that shows that it's part of the current deal offer.
You'll only get a successful deal if what you're offering is as or more valuable than what the other person is offering, though the value of the trade is modified by your Barter skill. Appraise will allow you to assess the quality of the deal ("I need a moment to consider this deal...", or some similar dialogue option), though if you don't have a reasonable number of ranks in it then your assessment is liable to be way off the mark.
If you choose the dialogue option to make the offer and it's accepted, the trade will happen. If it isn't (because you weren't offering enough), the NPC will say that they don't like the deal and their willingness to barter will decrease a bit - or a lot if you offered them something insultingly bad.
Repairs can be done by a specific NPC on the second level. You pay him directly in coins. You can also perform your own repairs if you have the Repair skill, although it's advisable to save first since you can easily do damage to an item or even destroy it if your skill is too low.