Let $X$ be the random variable that counts the number of tosses until we get two successive tosses of the same type. Although you did not say so explicitly, I assume that you want the probability mass function of $X$.
What is the probability that $X>n-1$? We need to have a sequence of tosses of length $n-1$ and of type HTHTHT and so on (alternating heads and tails, starting with head), or THTHTH and so on. The probability that the first type of sequence is followed up to and including the $(n-1)$-th toss is $\frac{1}{2^{n-1}}$. The second type of sequence has the same probability, for a total of $\frac{2}{2^{n-1}}$.
The number $X$ of tosses is equal to $n$ if $X>n-1$ and the last toss matches the next to last toss. The probability of that is $\frac{1}{2}$, so
$$P(X=n) =\frac{2}{2^{n-1}}\cdot\frac{1}{2}.$$
This simplifies to $\dfrac{1}{2^{n-1}}$. Note that $n$ ranges over the integers that are $\ge 2$.
Another way: The first toss doesn't matter. After that, it is just a matter of matching the previous toss. So it is very much like tossing a fair coin and winning if you get (say) heads. The only difference is the "wasted" toss at the beginning. If we are tossing a fair coin, and $Y$ is the number of tosses until the first head, then $P(Y=n)=\frac{1}{2^n}$ ($n=1, 2, \dots$). But $X$ has the same distribution as $Y+1$. So $P(X=n+1)=P(Y=n)=\frac{1}{2^n}$, or equivalently $$P(X=n)=P(Y=n-1)=\frac{1}{2^{n-1}}\quad (n=2,3,\dots).$$
Generalization: Suppose that the probability of a head is $p$, and the probability of a tail is $q=1-p$. Either analysis of the problem can be extended to the more general situation. We win on the $n$-th toss if we did not win on the first $n-1$, and then the $n$-th toss matches the previous one.
It is convenient to split the analysis into two cases, $n$ odd and $n$ even. We do a full analysis of the odd case. So let $n=2m$. As is the first analysis, there are two ways to win on the $(2m+1)$-th toss. Either (i) we went HTHTHT and so on, with a tail on the $(2m)$-th toss, and then a tail again on the $(2m+1)$-th toss, or (ii) we went THTHTH and so on, with a head on the $(2m)$-th toss, and a head again on the $(2m+1)$-th toss.
The probability of (i) is $p^mq^m q$ and the probability of (ii) is $q^mp^mp$. Add them together. We get $p^mq^m(p+q)$, which is $p^mq^m$ ($m=1,2,\dots)$.
Next we deal with the case $n$ is even, say $n=2m$. The calculation is very similar to the previous one, so it will be omitted. The probability is the slightly more complicated-looking $p^mq^{m-1}p+q^mp^{m-1}q=p^{m-1}q^{m-1}(p^2+q^2)$, where $m$ ranges over the positive integers.
Actually, you can show @Henry's answer is exact: If you talk about number of sequences rather than probabilities, you get that N(heads run or tails run) equals N(heads run) + N(tails run) - N(Both run) and this is exact.
Another way to find the number of arrangements with both 3 running heads and 3 running tails is as follows:
Let $R(N$) be the number of arrangements of $N$ outcomes such that there are three consecutive of one particular result (say 3 consecutive heads) among the $N$. Then
$$ R(2) = R(1) = 0 \\
R(3) = 3 \\
R(N) = 2^{N-3} + R(N-3) + R(N-2) + R(N-1)
$$
where the first term comes if the first three results are HHH, the second if they are HHT, the third if the first two are HT, and the last term if the first result is T.
Using this recursion it is easy to tabulate values of $R(N) = \{ 1,3,8,20,47,107,238, 520 \}$.
Now define $B(N;1)$ as the number of arrangements of $N$ results giving both a run of heads and a run of tails, given that coming in we have only one consecutive head or tail. And define $B(N;1)$ as the number of arrangements of $N$ results giving both a run of heads and a run of tails, given that coming in we already have two consecutive heads or tails. Then the desired number of arrangements will be $2B(9;1)$ because on the first toss we get either heads or tails and in eaither case that leaves us with 9 tosses and a start of only 1 in a row.
$$
B(1;2) = B(2;2) = B(3;2) = B(1;1) = B(2;1) = B(3;1) = B(4;1) = 0 \\
B(4;2) = B(5;1) = 1; \\
B(N;1) = B(N-1;2)+B(N-1;1) \\
B(N;2) = R(N-1) + B(N-1;1)
$$
To explain those last two equations, if you come in with a run of 1, the next toss either matches it (and you have a run of two with $N-1$ tosses to go) or it does not match and you have a run of 1 to start $N-1$ tosses. And if you come in with two in a row you either match those and have to find a run of three of the other specific type, or you miss and are in the one-in-a-row case with $N-1$ tosses left.
These equations are easy to tabulate, and you get in the last step $$B(9;1) = B(8;2)+B(8;1) = 60 + 37 = 97$$
so the desired probability is $\frac{2\cdot 97}{1024}$.
Best Answer
The natural test for a fair coin would be to compare the numbers of Heads and Tails, unless you wanted to include independent identical distributions in the null hypothesis as well (which you might if you did not conduct the test)
But you have said you want to look at the longest run
$6$ is rather short for the longest run in $1000$ tosses of a fair coin which is i.i.d. equally probably heads or tails. Since an i.i.d. unfair coin would tend to give longer runs, the doubt here could be that $6$ might come from a non-i.i.d process, possibly an attempt to fake a random sequence
You might intuitively guess that the longest run could be of the order of $\log_2(n)$ so about $10$ in this case ($10$ is indeed the median and mode here, and slightly below the expectation).
There are explicit expressions but it may be quicker to use a Markov calculation, producing something like the following, which suggests that at over $95\%$ confidence you might reject the null hypothesis when seeing longest runs of $7$ or fewer or of $16$ or more from a sequence of $1000$ results