Say we have observed a finite sequence of coin flips. Is there a metric for how likely this sequence is generated by a truly random coin flip.
For example, if we flip a coin 1000 times presumably seeing 500 heads and then 500 tails is less likely than a random assortment of Heads and Tails.
Also, presumably we would not see every even flip be a tails and every odd flip to be a heads.


There are some different metrics which can be used to indicate randomness when flipping a coin. One of these is to analyze the length of longest runs.
The derivation of this generating function is given in detail in section I.4.1 in Analytic Combinatorics by Philippe Flajolet and Robert Sedgewick.
Another metric is the first and last equality of number of heads and tails when flipping a fair coin $n$ times. This is strongly connected with the so-called Arcsine law. The following is from chapter III: Fluctuations in Coin Tossing and Random Walks of the classic An Introduction to Probability Theory and Its Applications, Vol. I by W. Feller.
Other metrics are the number of changes of sign (more heads than tails or vice versa), first passages and returns to the origin, the equidistribution of heads and tails, etc. Chapter III by W. Feller provides a thorough introduction.