In a previous paper we outlined how discrete torsion can be understood geometrically as an analogue of orbifold U(1) Wilson lines. In this paper we shall prove the remaining details. More precisely, in this paper we describe gerbes in terms of objects known as stacks (essentially, sheaves of categories), and develop much of the basic theory of gerbes in such language. Then, once the relevant technology has been described, we give a first-principles geometric derivation of discrete torsion. In other words, we define equivariant gerbes, and classify equivariant structures on gerbes and on gerbes with connection. We prove that in general, the set of equivariant structures on a gerbe with connection is a torsor under a group which includes H^2(G,U(1)), where G is the orbifold group. In special cases, such as trivial gerbes, the set of equivariant structures can furthermore be canonically identified with the group.