First off, you need to know that Bell's Theorem purports to prove that for quantum mechanics to be true, local realism must be false. More precisely, that entangled particles communicate their states to each other faster than light. This is simply wrong.
Background: Quantum particles are really waves. The wave function is the basis of QM. It shows how the probability of a particle being in some state evolves over time.
Entangled particles have opposite properties. When treated as waves (which they are), their phases are 180 degrees (pi radians) apart.
Probability: Our knowledge of what state something is in, expressed through statistics. In QM, probability is expressed as a sum of square roots. If a particle can have two states, "heads" and "tails", and each state shows up 1/2 of the time, their probabilities are expressed as: (1/√ 2) + (1/√ 2). Rant: The main problem with the Copenhagen Interpretation of QM is that they believe the probabilities are the actual particle, and that the coin can really be heads and tails at the same time until you look at it. In other words, they mistake the map for the territory.
Bell's Theorem (AKA Bell's Inequality): For a decent explanation of this, watch the "Looking Glass Universe" series of videos on the topic here. Fun, isn't it? Basically, Bell's Theorem states that for local realism to hold, you count up the states a particle can be in, compare it to the QM derived probability, and you'll find that the QM probability is greater that local realism allows. Experiments prove this. (More background: the EPR paradox.)
Fault in Bell's Theorem: It's completely stupid to treat analog sine waves as digital square waves. Bell's Theorem ignores the simple fact that outcomes have different probabilities of occurring. Looking Glass Universe has a video that indirectly shows this here.
When you measure a particle, the particle interacts with the measuring device in some statistically significant way. Measuring always changes a particle's properties. So, when you measure spin, the only possible results are up and down. (These are short hand terms for right handed and left handed spins, by the way. They come up because they way the testing device works makes electrons either go up or down, based on their spin.) However, the probability of getting spin up isn't always 50% (1/√ 2). It's based on the state of the electron and the state of the testing device. The more the electron's spin is pointed off the axis of the apparatus, you have a smaller chance of getting an "up" result, and a larger chance of getting a "down" result. Because these are waves interacting in a probabilistic fashion. For a demonstration, watch Minutephysic's video here.
The flaw is simple. Sine waves are not merely on or off, positive or negative. They have a continuously changing phase. If you measure it crudely, you will get a result of positive or negative. But that's ignoring a lot of information about the wave. Look at the images below, and see if you can tell the difference between a sine wave and a square wave. (Hint: The sine wave is analog, where the square wave is digital.)
Images from Wikipedia
The fundamental error shown with a very simple example to make it more obvious: Assume that you have an unfair coin. Heads shows up 1/3 of the time, tails 2/3. If you toss the coin twice, how often would you expect to see heads come up twice? 1/3 * 1/3 = 1/9. How often would you expect to see tails come up twice? 2/3 * 2/3 = 4/9. But if you simply lay out a table of all possible outcomes (because outcomes are all you can measure), it shows two heads 1/4 of the time and two tails 1/4 of the time: equal probabilities! Flip 1 Flip 2
Head Head
Head Tail
Tail Head
Tail Tail
Bell's Theorem does not rule out local realism. It rules out analog being digital, which is true by definition. Quantum coins are not fair.
The map is not the territory.
Edit: Here are two videos giving a very clear and comprehensive view of Bell's Inequality. It should be obvious where the problem lies - when you assume that all probabilities are always equivalent (the a-b-c chart in the first video), you're describing a square or triangle wave, not the sine waves of reality.