Here is the basic idea: If your mean is (roughly) Normally distributed with mean mu and variance sigma^2, then the estimator of the mean will be N(mu,sigma^2/n). Here is the proof:
Let X_bar = 1/n * (X1 + X2 + ... + Xn).
= E[1/n * (X1 + X2 + ... + Xn).]
= 1/n * (E[X1]+ E[X2] + ... + E[Xn]).
= 1/n * n * mu = mu
= Var[1/n * (X1 + X2 + ... + Xn)]
= 1/n^2 * (Var[X1] + Var[X2] + ... + Var[Xn])
= 1/n^2 * n*sigma^2 (Assuming all Xi's are independent which means covariance is 0)
Since our variance is sigma^2/n, our standard error is the square root of this which is sigma/SQRT(n) and that completes the proof of that result plus normality.
If you have a big enough sample, you use the central limit theorem for normality. If you are using an estimate of the standard deviation, then you use a t-distribution (but again if you have enough of a sample, you can use a normal distribution approximation regardless).