Does the following identity hold?

This is correct. In order to prove it, we need a lemma first:

I claim that for any $t\in G$ either $tK\cap H$ is empty or $|tK\cap H|=|K\cap H|$. To prove this, let $|K\cap H|=n$ and then let $k_1,k_2,\dots,k_n$ be the distinct members of $K\cap H$. And assume $tK\cap H$ is nonempty, so there is some $y=tk\in tK\cap H$. Then the elements $yk_1,yk_2,\dots yk_n$ must all be distinct. But $y,k_i\in H$, so $yk_i\in H$, and $yk_i=(tk)k_i=t(kk_i)\in tK$. So we have identified $n$ distinct elements of $tK\cap H$, which means that if we let $m=|tK\cap H|$ then $m\geq n$.

Now, let $tk_1,tk_2,\dots,tk_m$ be the distinct elements of $tk\cap H$. But if $tk_1\in H$ then $(tk_1)^{-1}=k_1^{-1}t^{-1}\in H$, and so the elements $(tk_1)^{-1}tk_1,(tk_1)^{-1}tk_2,\dots,(tk_1)^{-1}tk_m$ must all be distinct elements of $H$. But we can simplify those elements down to $k_1^{-1}k_1,k_1^{-1}k_2,\dots,k_1^{-1}k_m$, which clearly must be elements of $K$. So we have identified $m$ distinct elements of $K\cap H$, meaning that $n\geq m$, and therefore $n=m$.

Now, we prove the main result. We know that the cosets $tK,\ t\in T$ are a partition of $G$, and therefore the sets $tK\cap H$ are a partition of $H$. Let $T'=\{t\in T|tK\cap H\neq \varnothing\}$. Then if $|K\cap H|=n$, we have for every $t\in T'$ that $|tK\cap H|=n$. We also know that $|H|=mn$ for some integer $m$, and therefore $|T'|=m$. Finally, we know that restricting $t$ to $T'$ doesn't change the sum $\sum |tK\cap H|^2$, since if $t\not\in T'$ then $|tK\cap H|=0$. Putting it all together:

\begin{align*} \sum_{t\in T} |tK\cap H|^2&=\sum_{t\in T'} |tK\cap H|^2\\ &=\sum_{t\in\{t_1,t_2,\dots,t_m\}}n^2\\ &=mn^2\\ &=n\cdot(mn)\\ &=|K\cap H|\cdot |H| \end{align*}


This is basically the same argument as Benjamin's, but I dislike putting group elements in lists.

Let $T'=\{t\in T\mid tK\cap H=\varnothing\}$ as in the other answer.

Not only is $|tK\cap H|$ always either $0$ or $|K\cap H|$, but it's a coset of $K\cap H$. That is, if $s\in tK\cap H$ (i.e. the intersection is nonempty) then $s\in tK$ means $tK=sK$ and $s\in H$ means $H=sH$ so

$$ tK\cap H=sK\cap sH=s(K\cap H). $$

This yields a map $T'\to H/(K\cap H)$. It's actually a one-to-one correspondence.

Since the $tK$s (hence the $tK\cap H$s) are disjoint, this map is one-to-one, and it's also onto since $G/K$ is a partition so every coset of $H/(K\cap H)$ intersects some $tK$ (hence some $tK\cap H$).

This means we have

$$ \sum_{t\in T'} |tK\cap H|^2=\left|\frac{H}{K\cap H}\right||K\cap H|^2 = |H||K\cap H|. $$