What is $g^{(2)}$ in the context of quantum optics? And how is it calculated? I have been studying research papers on Quantum Optics and non-linear optics. I frequently come across the $g^{(2)}$ value.  What does it signify?  What is its importance?  How to calculate it?  And do the calculation methods vary?  If yes, what method is employed for which system?  Also, as this is my first time posting a question on stackexchange, please feel free to tell me how to improve my question posting skills.
 A: Correlation functions, such as $g^{(2)}(\tau)$ (or $g^{(1)}(\tau)$, as also mentioned in glance's answer) in quantum optics are employed to evaluate the quantum degree of coherence of an optical source. Frequently discussed examples of sources are lasers (that generally produce coherent light), thermal lamps (that generally produce chaotic light), or an excited atom (that produces a single photon upon decay). 
Approaching from an entirely classical perspective, an expression for the second-order (temporal) coherence is given by
$$g^{(2)}(\tau) = \frac{\langle\bar{I}(t)\bar{I}(t+\tau)\rangle}{\bar{I}^2}.$$
with $\bar{I} = \langle\bar{I}(t)\rangle$ being the long-term average intensity of the field. The value $g^{(2)}(0)$, i.e. the interference between the intensities (and not fields) at the zero time-delay $\tau=0$, carries a special significance (when you hear someone talking about the value of $g^{(2)}$, it is likely that he/she is referring to the $g^{(2)}(0)$ value). One can see from the above equation that $g^{(2)}(0) \geq 1$.
By treating the fields in a quantized manner, i.e. by associating the annihilation operator $\hat{a}$ with the field, an expression for the second-order quantum degree of coherence is given by
$$g^{(2)}(\tau) = \frac{\langle\hat{a^{\dagger}}\hat{a^{\dagger}}\hat{a}\hat{a}\rangle}{\langle\hat{a^{\dagger}}\hat{a}\rangle^{2}}.$$
There are multiple reasons to resort to $g^{(2)}(\tau)$ calculations for characterizing a given optical source. For instance, differences between the values of the first-order coherence $g^{(1)}(\tau)$ calculated as per the classical or quantum theory may not be clear cut[1]; both produce numerical values in the same range $0 \leq |g^{(1)}(\tau)| \leq 1$. 
In contrast, the classical predictions of $1 \leq g^{(2)}(0) \leq \infty$ and $g^{(2)}(\tau) \leq g^{(2)}(0)$ may not hold in the quantum theory. To elaborate a bit further, a source that yields a value in the range $0 \leq g^{(2)}(0) < 1$ belongs to the `exclusive quantum club'. The excited atom mentioned in the first paragraph can emit one and only one photon at a time. 
If you are not very familiar with annihilation/creation operators, you can still try to imagine the classical formula (with average intensities) applied in such a case -- the numerator would be zero, leading to $g^{(2)}(0) = 0$. This may be considered as a condition for a source to be nonclassical in nature. 
Calculating $g^{(2)}(\tau)$ in practice (in an actual experiment) can be fairly tricky therefore I won't dwell on that as I am not an expert. 
[1] R. Loudon, The Quantum Theory of Light
A: What is it?
From Mark Fox's Quantum Optics, an introduction, p.111:

The second-order correlation function $g^{(2)}(\tau)$ is the intensity analogue of the first-order correlation function $g^{(1)}(\tau)$ that determines the visibility of interference fringes. (...) $g^{(1)}(\tau)$ quantifies the way in which the electric field fluctuates in time, whereas $g^{(2)}(\tau)$ quantifies the intensity fluctuations.In classical optics texts, $g^{(2)}(\tau)$ is often called the degree of second-order coherence.

Note that here and in the following we are referring to the degree of second-order temporal coherence, which is (as far as I know) the one usually considered.
A generalization of this notion to include the spatial correlations can be found for example in Loudon, p.112.
See also the related Wikipedia article
How is it defined?
The second order correlation function (or degree of second-order time coherence) $g^{(2)}(\tau)$ for a beam of light of intensity $I(t)$ is defined as:
$$ g^{(2)}(\tau) \equiv
\frac{\langle I(t)I(t+\tau) \rangle}{\langle I(t) \rangle^2}, $$
where $\langle \cdot \rangle$ denotes the time average.
From an experimental point of view, given that the number of counts $n(t)$ registered on a photon-counting detector is proportional to the intensity of the impinging beam, we can rewrite this classical definition of $g^{(2)}(\tau)$ as:
$$ g^{(2)}(\tau) =
\frac{\langle n(t) n(t+\tau) \rangle}
{\langle n(t) \rangle^2}. $$
Physical meaning
We can think of $g^{(2)}(\tau)$ as answering the following question:
"I've detected a photon at time $t$. What is the probability of detecting another photon at time $t+\tau$?",
or more generally "I've detected $n$ photons at time $t$. What is the probability of detecting a similar number of photons at time $t+\tau$?".
More precisely, $g^{(2)}(\tau)$ gives us the degree of correlation between the number of photons detected at time $t$ and at time $t+\tau$. This tells us how much the information about the number of photons at time $t$ translates into knowledge of what I will measure at time $t+\tau$.
IMPORTANT NOTE: a very important value is $g^{(2)}(\tau=0)$ (see the following). However, in the way we defined $g^{(2)}$ this is also kind of ill defined: if I've measured $n$ photons at time $t$, what does it mean to ask how many photons will be measured at time $t+0=t$? I will interpret it in the following as the number of photon counts at an infinitesimally small time after $t$.
Values of $g^{(2)}(\tau)$
A threefold classification of light according to the second-order correlation function can be made as following:

*

*bunched light: $g^{(2)}(0) > 1$,

*coherent light: $g^{(2)}(0) = 1$,

*antibunched light: $g^{(2)}(0) < 1.$

For coherent light, like that produced by a laser, the number of photon counts is proportional to the intensity, which is by definition (in the simple scenario considered here) constant over time. This means that the number of counts at times $t$ and $t+\tau$ are uncorrelated, hence $g^{(2)}(\tau)=1$ for any $\tau$. Note that the average numbers of counts are not uncorrelated, in general, and indeed in the simple example of a beam with constant intensity that we are considering here, the averages are constant. Still, the fluctuations of the intensities are uncorrelated. This means that no matter how well I know the distribution of intensities at time $t$, I will never be able to reduce my uncertainty about the intensity fluctuations at time $t+dt$.
Now, $g^{(2)}(0)$ tells us how often we detect two photons at times very close to each other (we imagine here to always detect one or zero photons at a time). While for coherent light the two detection events are uncorrelated, for light produced by other kinds of classical sources, like chaotic light, we can have intensity fluctuations on the source and therefore a tendency for detection events to be sometimes closer to each other. In these cases one talks of bunched light.
This means that given a detection event at $t$, there is a higher probability of another detection event at times close to $t$.
These kinds of sources therefore satisfy $g^{(2)}(0) > 1$.
Indeed, it can be shown that classical light sources must always satisfy
$$ g^{(2)}(0) \geq g^{(2)}(\tau) \geq 1 .$$
This means that in the classical view of light, $g^{(2)}(0)<1$, i.e. antibunched light, is not possible.
Why is it important?
From the last statement we can now see the importance of this parameter:
it allows us to experimentally rule out the classical view of light.
If we manage to experimentally detect antibunched light, then we must surrender and admit the necessity of a quantum picture (which of course is what actually happened).
About experimental detection of antibunched light, see also Hanbury Brown and Twiss.
