Why is this hamiltonian not the energy? 
Let a pendulum of length $\ell$ be connected to a rod that rotates with constant angular velocity $\omega$. $\theta$ is the angle of the pendulum wrt $z$ axis ($z$ axis is parallel to the rod).

I have found the Hamiltonian and the Lagrangian already, the fact is that the Hamiltonian is not the energy of the system, even though it is still conserved:
Constraint: $$r - \ell = 0.$$
Lagrangian: $$L = \frac{m\ell^2((\theta \dot)^2+w^2 \sin^2(\theta))}{2} + mg\ell\cos(\theta).$$
Hamiltonian = $$H = \frac{p_\theta ^2}{2m\ell^2} - \frac{m\ell^2w^2\sin^2(\theta)}{2} - mg\ell\cos(\theta).$$
The constraint is holomonic and time independent.
The lagrangian is not time dependent.
The Hamiltonian is also not time dependent.
The potential is not velocity dependent.
So what is the matter? What i mean is, suppose the hamiltonian and the lagrangian and, also, the constraint was given to us, and the question be: "Is this hamiltonian the energy of a system?" without revealing to us the system itself, how could i be able to answer that? That is, how could we conclude this hamiltonian is not the energy? Where is the problem? something i missed?
Of course, what i want is to know when the hamiltonian is the energy just by sight, not doing any calculation.
 A: 
I have found the Hamiltonian and the Lagrangian already, the fact is that the Hamiltonian is not the energy of the system, even though it is still conserved...

I'm a little confused here, but what I think you are asking is why the Hamiltonian is not equal to the sum of the Kinetic Energy ($T$) and Potential Energy ($V$), which I will call the "Total Energy."

The constraint is holomonic [sic] and time independent.

The one constraint that you wrote down is holonomic and time independent. There may be other time dependent constraints, but it is hard to tell from the statements in the question.

The lagrangian is not time dependent.

The Lagrangian actually is time-dependent (implicitly), but I think you mean that $\partial L/\partial t=0$, which we usual say in words as: the Lagrangian is not explicitly time dependent.

The Hamiltonian is also not time dependent.

Yes. The Hamiltonian is constant in time.
The requirement for the Hamiltonian to equal the Total Energy is that: (1) the potential is a function of the coordinates only; (2) the kinetic energy is homogeneous and of degree 2 in the velocities.
In your case, the kinetic energy is also a function of the position (due to the forced/fixed rotation, I guess, it is a bit unclear since there is no picture in the question).
Because of this you will find that the difference between the Hamiltonian and the Total Energy is
$$
m \ell^2\omega^2\sin^2(\theta)\;.
$$
You can see this by recalling that:
$$
H = \sum_i \frac{\partial L}{\partial \dot q_i}\dot q_i - L
$$
$$
=\sum_i \frac{\partial T}{\partial \dot q_i}\dot q_i - T + V\;.
$$
If $T$ was homogeneous of degree 2 the first two terms in the above equation would be $2T$, but it is not; T depends on the position (and on the fixed $\omega$).
Instead:
$$
H = 2T - m\ell^2\omega^2\sin^2(\theta) - T + V
= T + V - m\ell^2\omega^2\sin^2(\theta)
$$
