Generalised Kepler's III law? I have derived the following equation for the time-derivative of the angle that an orbiting particle subtends with one of the coordinate axes, with the other particle at the origin (this is the focus of the ellipse)
\begin{equation}
\dot{\theta} = \left(\hspace{-0.2mm}\frac{GM}{a^{3}}\hspace{-0.2mm}\right)^{\!\!1/2} \frac{(1+e\cos\theta)^{2}}{{(1-e^{2})^{3/2}}}.
\end{equation}
Note that $\dot{\theta}=\omega$ and that this equaton is correct, according to a physics textbook. I then noticed that this is nothing other than Kepler's III law, but with some additional factor relating to angle and ellipticity. Why does this factor appear? What does it mean?
 A: Writing $\dot\theta=\omega$ is slightly dangerous because it will give you the impression that $\dot\theta$ is constant, but it definitely isn't constant when $e>0$: Kepler's second law demands the planet move faster when it is closer to the focus than when it's far away. The factor $(1+e\cos\theta)^2$ is there to ensure this.
The equation you found does indeed reduce to Kepler's third law for a circular orbit, but in general it is simply the (reduced) equation of motion of the planet. This is a differential equation for $\theta(t)$ and it is solvable by quadratures: you can reduce it to $t=\text{SomeIntegral}(\theta)$, which "solves" the problem. Unfortunately, the integral is an elliptic integral, which does not reduce to elementary functions. You need to use the Jacobi elliptic functions to invert that relation and get $\theta=\theta(t)$. (This isn't as bad as it sounds: the Jacobi functions are, in practice, not (much) harder to calculate than a sine or a cosine.)

Note also that Kepler's third law, $a^3/T^2=GM/4\pi^2$, holds regardless of the ellipticity. Here $T$ is the time taken to complete one orbit, and only equals $2\pi/\dot\theta$ when the latter is constant. (This is the kind of mistakes that writing $\dot\theta=\omega$ will get you into: it makes you think that the other relations $\omega$ is often in, like $\omega=2\pi/T$, still hold, though they usually don't.)
Your intuition of "an average over one period" does hold some water, but you need to be very careful when doing it. $T$ is the time taken to complete one orbit, so $\theta$ goes from $0$ to $2\pi$. This means that
$$T=\int_0^Tdt=\int_0^{2\pi}\frac{d\theta}{d\theta/dt}=\sqrt{\frac{a^3}{GM}}\int_0^{2\pi}\frac{(1-e^2)^{3/2}}{(1+e\cos(\theta))^2}d\theta,$$
and the last integral should come out to $2\pi$ if you do everything right. Thus you could say that $T$ is the average of $2\pi/\omega$ over one loop, taking care to do the average so all angles count equally (instead of all times!). But I would call that over-reading into the calculation, which is important in its own right.
The bottom line, then, is that you don't need averages to make sense of Kepler's third law in the elliptical case. This shouldn't surprise you! Kepler knew the orbits he studied were not circular and that $\dot\theta$ was not constant (so well that those facts also carry his name), and still managed to formulate the third law.
A: This Kepler's second law, not his third one.  It works for any central force law.
In fact, if the orbit is the curve $r=f(\theta)$ in polar coordinates then the derivative of $\theta$ with respect to time is $\frac 1{2 f(\theta)^2}$.  In the Kepler case,  $f(\theta)=\frac 1{(1+e \cos(\theta))}$ which gives the above formula (I am ignoring the physical constants for the sake of simplicity).  Note that you don't have to know the force law to derive the first formula---the fact that it is central suffices.
