How can I calculate the mean position on the circle or mean direction? How should I calculate the mean of some circular variable? Suppose we have observed a phenomenon repeatedly occurring each day around midnight between 23 and 1 o'clock. What is the mean time of this phenomenon occurrence then? To keep things simple, let's reduce the problem (temporarily) to obtaining a mean of two values on the 24-hour clock dial: 23 and 1. Their mean calculated the usual way is
$$
\frac{23+1}{2}=12
$$
but it is intuitively clear that the correct answer lies on the opposing side of the circle - at midnight.
Analogously we can ask what is the mean wind direction calculated based on two measurements: NE and NW. Depending on the reference direction, the azimuth angles may be expressed as (respectively):
$45^\circ$ and $315^\circ$ - relatively to the north (and counted clockwise) or
$225^\circ$ and $315^\circ$ - relatively to the east (and counted clockwise).
In the firs case we get: $\frac{45^\circ+315^\circ}{2}=180^\circ$ (from the N, meaning precisely the S),
and in the second one: $\frac{225^\circ+315^\circ}{2}=270^\circ$ (from the E, meaning precisely the N).
Of course, these are only toy examples, and things became more cumbersome when dealing with many points or continuous probability distribution. So what is the correct approach to find means of values belonging to topologically non-trivial manifolds like the circle?
 A: The variables mentioned are points belonging to the manifold, which is the sphere (or circles if you consider the latitude and longitude separately). Therefore, they cannot be treated as if they belonged to Euclidean space.
There are two main types of circular mean: extrinsic and intrinsic.
Extrinsic mean is simply the mean calculated as the centroid of the points in the plane projected onto the circle.
$$
\bar{\vec{x}}=\frac{1}{N}\sum_{j=1}^N \vec{x}_j=\frac{1}{N}\sum_{j=1}^N [x_j,y_j]=\frac{1}{N}\sum_{j=1}^N [\cos{\phi_j},\sin{\phi_j}]
$$
$$
\hat{\bar{x}}=\frac{\bar{\vec{x}}}{|\bar{x}|}
$$
$$
\DeclareMathOperator{\atantwo}{atan2}
\bar{\phi}_{ex}=\atantwo(\hat{\bar{x}})
$$
It is NOT a mean calculated using the natural metric along the circle itself.
Intrinsic mean, on the other hand, does have this property. This mean can be obtained by minimizing the Fréchet function.
$$
\DeclareMathOperator*{\argmin}{argmin}
\bar{\phi}_{in}=\argmin_{\phi_0\in C} \sum_{j=1}^N (\phi_j-\phi_0)^2
$$
$C$ - some interval with length of $2\pi$
For discrete data, you can also analytically determine the $N$ points suspected of being the mean and then compare them using the Fréchet function.
$$
\bar{\phi}_k=\arg \sqrt[N]{\prod_{j=1}^N e^{i\phi_j} }=\bar{\phi}_0+k\frac{2\pi}{N}
$$
Where the N-th root is a N-valued function with outputs indexed with $ k\in\{1,\dots,N\} $. They are distributed evenly on the circle. And $ \bar{\phi}_0 $ is a usual mean calculated in an arbitrary range of angle values of length of $2\pi$.
If somebody dislikes the complex numbers, can do without them, but at the cost of switching to modular arithmetics.
$$
\bar{\phi}=\frac{1}{N}\sum_{j=1}^N \left[\phi_j\right]_{2\pi}
$$
$$
\bar{\phi}_k=\frac{1}{N}\sum_{j=1}^N \left(\phi_j+k_j2\pi\right)=\frac{1}{N} \left(\sum_{j=1}^N \phi_j+k2\pi\right)
$$
The result is, of course, the same.
Then you have to compare the points suspected of being the mean using the Fréchet function.
$$ 
\DeclareMathOperator*{\argmin}{argmin}
\bar{\phi}_{in}=\argmin_{k\in\{1,\dots,N\}} \sum_{j=1}^N (\phi_j-\bar{\phi}_k)^2
$$
Where the search for minimum runs over only $N$ discreet indices.
I recommend the material that I have prepared on this subject:
Circular means - Introduction to directional statistics.
