Why is bromine produced at the anode when aqueous sodium bromide undergoes electrolysis?
This is  how I see it:

In the electrolysis of NaBr, water is reduced at the cathode. This occurs because water is more easily reduced than are sodium ions. This is reflected in their standard reduction potential.

At cathode reduction of water occurs:

$$\ce{2H2O(l) + 2e- -&gt; H2(g) + 2OH-(aq)}$$

And hydrogen gas is produced

At the anode, where oxidation occurs, the standard oxidation potential of water is –1.23 volts, while that for bromide ions is -1.07 volts.

The production of bromine itself has a negative electrode potential.
One of the half-reactions must be reversed to yield an oxidation. 

$$\ce{Br^2- -&gt; Br2 + 2e-}~~~~~~~ Eº -1.07$$

Remember that when one reverses a reaction, the sign of Eº (+ or –) for that reaction is also reversed. 

This means that bromide ions are more easily oxidized than water.

It is important to note: When current begins to flow, the distribution of ions around the electrodes changes, and the equilibrium electrode potentials no longer accurately apply.

I think other factors also apply;


Concentration
Temperature
Nature of ions