How did the characters gain their power to perform alchemy in FMA:Brotherhood? Is it genetic, or is it something that can be learned? After all, not everyone in the series can use alchemy.
Alchemy is just like most skills; the process of learning it is arduous, and some people will naturally be better than others.
From a young age, Edward and Alphonse Elric were exposed to alchemy, especially as their father had been a brilliant alchemist and left a gargantuan collection of books behind for the kids to read. This, however, was in addition to their already curious minds and their—especially Ed's—prodigal level of skill.
Following this, Edward (and later Alphonse, upon recovering lost memories) witnessed the realm beyond the Gate of Truth, wherein he absorbed a large amount of further knowledge about alchemy. He also underwent training from one of the most intelligent, brutal, and experienced trainers known to the universe: Izumi Curtis.
Basically, Ed and Al were able to receive knowledge, training, experience, and an exposure to the infinite reaches of alchemy, prior to the main storyline.
And you can contrast this further with the "normal" alchemists (that is, those who don't work for the military); the fact that we only hear of a couple who do not work for the military is a testament to how unsuccessful people have been at achieving a high level of skill with it. Keep in mind that alchemy involves the makeup of the entire world; from rock to air to water to human flesh, everything is composed differently, and specializing in more than one of these is a challenge at best. (Think of someone like Mustang who knows the basics of alchemy as well as flame alchemy, or Shou Tucker, who specialized in biochemical alchemy.)
In some very rare cases, alchemy can be inbred. In the case of the Dwarf in the Flask, he was more-or-less created from alchemical knowledge, and thus understood it very well.
But none of this means that alchemy is limited to only certain people. As I paraphrased above, some people are naturally more talented at some things: Some are better at creative tasks, some better at math, history, and so on. In the universe of Fullmetal Alchemist, alchemy is just another one of these skills that requires thousands of hours of work to fine-tune.
In the 2003 anime (outside of Brotherhood), the silver pocket watch given to State Alchemists can amplify their power; however, a knowledge of alchemy is required to use it (and of course, to become a State Alchemist).
So, how do characters learn alchemy? They learn it through hard work, perseverance, experience (rough or otherwise), and never giving up (and a little bit of luck never hurts). As you might notice, these are all the traits that a typical shounen hero (such as Ed) possesses.
In the original series, it's explained that everyone is born with a smaller Gate, connected to the Main Gate, which is then used to access the energy supplied from our world required to perform alchemy. As the person gets older, the connection gets weaker, which is why Dante uses a baby when she wants to call the Gate.
In Brotherhood, everyone is born with the ability to use alchemy; however, how it was taught to the populace is different.
In Amestris, it's said a man came from the East to teach the people how to use the energy from tectonic shifts and manipulation of matter toward scientifically practical ends. However, the method was flawed and because that man was Father/Dwarf it allowed him the ability to shut down everyone's ability to use alchemy.
In Xing, it's said that a doctor came from the West to teach the people about alkahestry which focused on using the energy in the Earth called the Dragon's Pulse; the Doctor was Van Hohenheim.
A Gate, however is created within those who have preformed Human Transmutation, as Father/Dwarf required a number of Gates in order to achieve his plan to become God and the only people who could do this was those who had at one stage performed Human Transmutation.
The actual ability to perform alchemy seems to be something that can be exchanged at least to God as at the end of Brotherhood, Ed gives up his ability to perform alchemy to God, in order to bring Al back to life. God gladly accepts this as a fair price, and congratulates Ed for being the first person to figure out what Equivalent Exchange is.