The [itex]e^{i \theta}[/itex] is used for a global transformation. Global because at any point you just apply a [itex]\theta[/itex] transformation. Transformation, well , that depends... for a U(1) where the generators are just numbers you can use the [itex]e^{i \theta}[/itex], whereas for some other symmetry the transformation should change and you use instead the generators [itex]T^a[/itex] on the exponential [itex]e^{i \theta_a T^a}[/itex].
For a simple case, consider that you have a complex number [itex]\psi = a + ib[/itex], transforming the [itex]\psi[/itex] itself will lead you to a [itex]\psi'= a' + i b'[/itex]. How are the two ([itex]\psi,\psi'[/itex]) connected? Well you can use that the multiplication of two complex numbers is a complex number so you can write:
[itex]\psi' = z \psi[/itex]
With [itex]z[/itex] an appropriate number that can apply for your given transformation. A complex number can be written as [itex]z= r e^{i \theta}[/itex] , and so an appropriate choice of ##z## would mean an appropriate choice for ##r## and ##\theta##.
Now if you are looking for a unitary transformation the [itex]r=1[/itex], otherwise you would change the magnitudes. And so you have:
[itex]\psi' = e^{i \theta} \psi[/itex].
So in fact what you are doing is getting [itex]\psi[/itex] as a "vector" on the complex plane, and you are making a rotation to it.
Now what would be the case if [itex]\theta[/itex] was in fact [itex]\theta(x)[/itex]?
Obviously this rotation doesn't happen anywhere on space [itex]x^\mu[/itex] in the same way. At a spacetime point [itex]x_1[/itex] you apply a rotation [itex]\theta_1= \theta(x_1)[/itex] whereas in a point [itex]x_2[/itex] you can apply a rotation [itex]\theta_2= \theta(x_2)[/itex].
It's naturally leading you to insert a "connection" (term from GR) into the game when you try to make invariant objects. The connection [itex]\Gamma_{\mu \nu}^\rho[/itex] in GR for example appears when you go from a global metric [itex]n_{\mu \nu}[/itex] to a local metric [itex]g_{\mu \nu}(x)[/itex]. Here the "ranks" are smaller and you end up with an "electromagnetic field" (better a U(1) gauge field) [itex]A_\mu[/itex].