Here is a combinatorial approach with an answer based upon generating functions. We develop a generating function
\begin{align*}
G(z)=\sum_{n=2}^\infty g_n z^n
\end{align*}
with $g_n$ counting the number of valid words of length $n$. These are binary words from a two character alphabet $V=\{T,H\}$ which have precisely one run of tails of length $2$ at the end of the word.
We can use $G(z)$ to calculate the expectation value $E(Z)$ since
\begin{align*}
E(Z)=\sum_{n=2}^\infty n \frac{g_n}{2^n}
=\frac{1}{2}\cdot\left.\frac{d}{dz}\left(G(z)\right)\right|_{z=\frac{1}{2}}\tag{1}
\end{align*}
We observe
The generating function $G(z)$ starts with $g_2z^2=z^2$ since the shortest valid word is $\color{blue}{TT}$.
There is only one valid word with length $3$, namely $H\color{blue}{TT}$.
Each valid word with length $n\geq 3$ ends with $H\color{blue}{TT}$.
The idea is to build valid words of length $n\geq 3$ by creating valid subwords of length $n-3$ and append $H\color{blue}{TT}$. In order to do so we start with a generating function for words of a two character alphabet $V=\{T,H\}$ which counts words with no consecutive equal characters at all.
These words are called Smirnov or Carlitz words. See example III.24 Smirnov words from Analytic Combinatorics by Philippe Flajolet and Robert Sedgewick for more information. (You might also find this answer helpful.)
The generating function $A(z)$ counting Smirnov words over a two character alphabet is according to the reference
\begin{align*}
A(z)=\left(1-\frac{2z}{1+z}\right)^{-1}
\end{align*}
The coefficient of $z^n$ of $A(z)$ gives the number of Smirnov words of length $n$, i.e. the number of words with no consecutive equal heads and tails.
Since there is no restriction to the distribution of heads, we can replace each character "H" in a Smirnov word by one or more "H"s, which means to replace
\begin{align*}
z\longrightarrow z+z^2+z^3+\cdots=\color{blue}{\frac{z}{1-z}}
\end{align*}
in the corresponding generating function $A(z)$.
Based upon $A(z)$ we obtain this way a generating function $B(z)$ with
\begin{align*}
B(z)&=\left(1-\frac{z}{1+z}-\frac{\color{blue}{\frac{z}{1-z}}}{1+\color{blue}{\frac{z}{1-z}}}\right)^{-1}\\
&=\left(1-\frac{z}{1+z}-z\right)^{-1}\\
\end{align*}
The coefficient of $z^n$ of $B(z)$ gives the number of words of length $n$ with no consecutive equal tails.
Since valid words of length $n\geq 3$ end up in $H\color{blue}{TT}$ we respect this fact by multiplying $B(z)$ with $z^3$. The special case, the word $TT$ which does not end in $H\color{blue}{TT}$ is additionally to respect and we obtain the generating function $G(z)$ counting all valid words as
\begin{align*}
G(z)&=z^2+z^3B(z)\\
&=z^2+z^3\left(1-\frac{z}{1+z}-z\right)^{-1}\\
&=\frac{z^2}{1-z-z^2}\tag{2}\\
&=z^2+z^3+2z^4+3z^5+5z^6+\cdots
\end{align*}
Note that (2) is essentially the generating function of the Fibonacci numbers. The coefficients give the number of valid words of length $n$
\begin{align*}
[z^2]G(z)=1:&\quad TT\\
[z^3]G(z)=1:&\quad HTT\\
[z^4]G(z)=2:&\quad HHTT, THTT\\
[z^5]G(z)=3:&\quad HHHTT, HTHTT, THHTT\\
[z^6]G(z)=5:&\quad HHHHTT, THHHTT, HTHHTT, HHTHTT, THTHTT
\end{align*}
Finally, we obtain from $G(z)$ according to (1) the expectation value
\begin{align*}
\color{blue}{E(Z)}&=\frac{1}{2}\cdot\left.\frac{d}{dz}\left(G(z)\right)\right|_{z=\frac{1}{2}}\\
&=\frac{1}{2}\cdot\left.\frac{d}{dz}\left(\frac{z^2}{1-z-z^2}\right)\right|_{z=\frac{1}{2}}\\
&=\frac{1}{2}\cdot\left.\frac{z(2-z)}{(1-z-z^2)^2}\right|_{z=\frac{1}{2}}\\
&=\color{blue}{6}
\end{align*}