Bar ends have two main benefits, they allow you to pull into climbs, and secondly they give a couple of hand positions more than flat bars. I had them on an XC bike, and they're great for resting your palms and wrists if they're getting buzzed or cramped, as you can hold the bars at the extremes with your thumbs hooked over the corner, or go all out for a pistol grip hold.
On my flat bar road bike I use them for a more stretched out aero position.
If you're going down the trekking or long distance comfort route, then go for the ergo fit type. eg
If you are wanting an XC style then simple alloys.
Both types simply bolt onto the end of your handlebars with pinch bolts once you've slid your grips, brake and gear levers inboard an inch or so to make room for them. . With the alloy type you'll need bar end plugs if you don't already have them