Splitting of the tangent bundle of a vector bundle
Solution 1:
The morphism $\pi:E\to M$ (which is a submersion) induces a surjective tangent morphism $T\pi: TE\to \pi^*TM\to 0$ whose kernel is (by definition) the vertical tangent bundle $T_vE$ .
There results the exact sequence of bundles on E $$0\to T_vE\to TE\stackrel {T\pi}{\to} \pi^*TM\to 0$$ Pulling back that exact sequence to $M$ via the embedding $i$ yields the exact sequence of vector bundles on M: $$0\to E\to TE\mid M \to TM\to 0 \quad (\bigstar )$$
The hypothesis that $M$ is compact is irrelevant to what precedes.
However if $M$ is paracompact, the displayed sequence $(\bigstar )$ splits and you may write $$TE\mid M \cong E\oplus TM$$
Since however the splitting of $(\bigstar)$ is not canonical, I do not recommend this transformation of the preferable (because intrinsic) exact sequence$(\bigstar)$.
Edit ( September 22, 2016)
I forgot to mention the interesting fact that $T_vE$ and $\pi^*E$ are canonically isomorphic as vector bundles on $E$, so that we have a canonical exact sequence on $E$: $$0\to \pi^*E\to TE\stackrel {T\pi}{\to} \pi^*TM\to 0 $$The equality $T_vE=\pi^*E$ ultimately rests on the fact that the tangent space to a vector space $V$ at any point $v\in V$ is canonically isomorphic to that vector space : $T_vV=V$.
Solution 2:
[Note to moderators: This is mostly a comment on the previous answer.]
A reference for the short exact sequence
$$ 0 \to \pi^*E\to TE \to \pi^* TM \to 0 $$
is [1, Vol. I, Chapter 3, Exercise 29 (page 103)]. Its restriction $ 0 \to E \to TE_{|M} \to TM \to 0 $ splits canonically, irrespective of any compactness assumption on the base, since $\pi\colon E\to M$ is split by the zero section. So we always have a canonical isomorphism of vector bundles:
$$TE_{|M} \cong TM \oplus E$$
As $\pi$ is a homotopy equivalence, it follows that the unrestricted sequence also splits, so that we have a (non-canonical) isomorphism
$$TE \cong \pi^*TM \oplus \pi^*E$$
A reference for this argument is [2, Kapitel IX, Satz 6.9 (page 365)].
[1] Michael Spivak, A Comprehensive Introduction to Differential Geometry
[2] Tammo tom Dieck, Topologie