Away from the poles $z = \pm 1$, we have
$$\iota_X \omega = \iota_{\partial_\theta} (d\theta \wedge dz) = (d\theta \wedge dz)(\partial_\theta, -) = dz$$
by the definition of the wedge product and $d\theta$, $dz$. Therefore $X$ has Hamiltonian function
$$H(\theta, z) = z$$
away from $z = \pm 1$, as
$$\iota_X \omega = dH.$$
Note that $\partial_\theta = 0$ at the poles $z = \pm 1$ and the poles are also critical points of the height function $H = z$, so we also have
$$\iota_X \omega = dH$$
at $z = \pm 1$ (simply because $0 = 0$). Therefore $\partial_\theta$ is a Hamiltonian vector field on $S^2$ with Hamiltonian function $H = z$.
For the first problem, you have already detected where the problem lies: the variable $\phi$ is not a function defined on the whole manifold. Indeed, it is a priori a function in a chart on the manifold and a chart usually does not cover by itself the whole manifold.
On the other hand, the particular case of the torus is special because we can more or less canonically 'parametrize' the torus by $\mathbb{R}^2$ (which is its universal cover), for instance via the map $q: \mathbb{R}^2 \to \mathbb{R}^2 / \mathbb{Z}^2 \cong T^2$. As $\phi$ can be chosen to be one of two cartesian coordinates on $\mathbb{R}^2$, its derivative $d\phi$ (on the plane) is left invariant by any translation, in particular the ones by vectors in $\mathbb{Z}^2$. As such, $d\phi$ 'passes to the quotient' i.e. there exists a well-defined closed 1-form $\eta$ on $T^2$ such that $q^{\ast}\eta = d\phi$. This is another motivation to write $\eta = d\phi$, but note that $\phi$ itself would be a multi-valued function on the torus (and hence not a genuine function, so we wouldn't consider it as an antiderivative to $\eta$).
On the sphere, any chart misses at least one point, so again it is not surprising that one can find an antiderivative to a closed 1-form inside this chart. But if you can't extend $\phi$ and $\theta$ to the whole sphere, it is not clear how you can extend their derivatives to globally closed 1-forms in the first place: your problem possibly does not show up. Besides, the fact that the vector field $X = \partial/\partial \theta$ on the sphere can be globally defined (by rotation invariance and also by the null vectors at the poles) is not related to the (im)possibility that $\theta$ (or $d\theta$) is globally well-defined, but only to the fact that $X \lrcorner \omega$ is a closed (and exact) 1-form : an antiderivative is the height function, which is clearly not the angle 'function' $\theta$.
The obstruction to a symplectic vector field $X$ to be Hamiltonian is precisely whether the closed 1-form $X \lrcorner \omega$ is exact. In other words, does the cohomology class $[X \lrcorner \omega] \in H^1_{dR}(M; \mathbb{R})$ vanish? (The nonvanishing of this class is the obstruction to $X$ being Hamiltonian.) This question makes sense on any manifold; the point is that when $H^1_{dR}(M; \mathbb{R})=0$, then the answer is 'yes' whatever the symplectic field $X$. So on the 2-sphere, any symplectic vector field is Hamiltonian, whereas on the torus it depends on the symplectic vector field considered. Put differently, the (non)vanishing of the 1-cohomology group is the obstruction to the equality $Symp(M, \omega) = Ham(M, \omega)$.
Best Answer
Remark: $\theta$ and $\varphi$ are regarded as the angle coordinates of $S^1 \subset \mathbb C$.
First we should recall that the 1-form $d\varphi$ is not the exterior derivative of $\varphi$ on $X$. Namely $\varphi$ is not defined on the whole space $T$. But it is defined on arbitrary simply connected open subset on $T$ (after choosing a branch).
For any exact 1-form $df$ (on $T$) and any closed curve $\gamma:[0,1] \to T$, we always have $$\int_{[0,1]} \gamma^*df = \int_{[0,1]} d(f \circ \gamma) = f(\gamma(1))-f(\gamma(0)) = 0.$$
On the other hand, considering the closed curve $\gamma(t):=(0,e^{2\pi t})$, we have $$\int_{[0,1]} \gamma^* d\varphi = \int_0^1 2\pi dt = 2\pi.$$ Therefore $d\varphi$ is not exact.