Definition of Casimir operator and its properties I'm not sure which is the exact definition of a Casimir operator.
In some texts it is defined as the product of generators of the form:
$$X^2=\sum X_iX^i$$
But in other parts it is defined as an operator that conmutes with every generator of the Lie group.
Are these definitions equivalent? 
If the answer is yes, how could I prove it (I'm thinking in using Jacobi's identity)?
 A: I'll give you enough hints to complete the proof yourself. If you're desperate, I'm following the notes by Zuber, which are available online, IIRC.
Let's start with some notation: pick some basis $\{t_a\}$ of your Lie algebra, then
$$ [t_a,t_b] = C_{ab}{}^c t_c$$
defines the structure constants. If you define
$$ g_{ab} = C_{ad}{}^e C_{be}{}^d,$$
then this gives you an inner product
$$(X,Y) := g_{ab} x^a y^b, \quad X = x^a t_a \text{ and } Y = y^b t_b.$$
Indeed this "Killing form" is related to the adjoint representation, as
$$(X,Y) = \text{tr}(\text{ad } X \text{ ad} Y)$$
(exercise!). Similarly,
$$g_{ab} =\text{tr}(\text{ad } t_a \text{ ad } t_b).$$ 
In this language, the Casimir $c_2$ is given by
$$ c_2 = g^{ab} t_a t_b, \qquad \text{ so}$$
$$[c_2,t_e] = g^{ab} [t_a t_b,t_e].$$
Now you need to do some basic work (expand the first factor of the commutator, work out the resulting brackets) and you'll see that this gives you
$$ \ldots = g^{ab} g^{dk} C_{bek} \{ t_a,t_d \}.$$
This vanishes (why?), so you're done!
Edit (regarding Peter Kravchuk's remark): when you write $c_2 \sim t_a t_b$, it's not really part of the Lie algebra. The only multiplication that "works" in Lie algebras is the commutator $[t_a,t_b]$. So these guys live in some richer structure, which is called the "universal enveloping algebra." Indeed you often hear that "the Casimir is a multiple of the identity matrix," but the identity matrix is seldom part of the Lie algebra (the identity in a Lie algebra is 0). In practice everything is self-evident, because you do calculations in some vector space.
A: I) The Casimir invariants of a Lie algebra $L$ over a field $\mathbb{F}$ are the central elements of the universal enveloping algebra $U(L)$. 
Example: The angular momentum square $\vec{J}^2$ is a quadratic Casimir invariant of the Lie algebra $L=sl(2,\mathbb{C})$.
II) Given a bilinear associative/invariant form $B:L\times L\to \mathbb{F}$, one can create a quadratic Casimir invariant, as explained on this Wikipedia page. 
A simple Lie algebra has a unique bilinear associative/invariant form (up to an overall normalization factor), namely the Killing form.
As a consequence, a simple Lie algebra has a unique quadratic Casimir invariant (up to an overall normalization factor)
$$C_2 ~:=~   t_a \otimes t^a~\in~ U(L), \qquad  t^a~:=~(\kappa^{-1})^{ab} t_b, \qquad   \kappa_{ab}~:=~{\rm tr}({\rm ad} t_a\circ{\rm ad} t_b).   $$
III) More generally, a semisimple Lie algebra that is built from $m$ simple Lie algebras has 
a basis a $m$ quadratic Casimir invariant. 
Example: The linear combination
$$\alpha_L \vec{J}_{\!L}^2+\alpha_R \vec{J}_{\!R}^2$$ 
is a quadratic Casimir invariant of the Lie algebra $L=sl(2,\mathbb{C})_L\oplus sl(2,\mathbb{C})_R$ for arbitrary constants $\alpha_L,\alpha_R\in\mathbb{C}$.
IV) There also exist cubic and higher-order Casimir invariants. For a semisimple Lie algebra $L$, e.g.,
$$C_n ~:=~  {\rm str}({\rm ad} t_{a_1}\circ\ldots\circ{\rm ad} t_{a_n}) t^{a_1} \otimes\ldots\otimes t^{a_n}~\in~ U(L),$$
where ${\rm str}$ denotes symmetrized trace. They are not all independent, though.
V) Finally, in response to Art Brown's comment: Racah's theorem states that the number of independent Casimir invariants for a complex semisimple Lie algebra $L$ is equal to the rank of the Lie algebra $L$. 
There exist generalizations of Racah's theorem to non-semisimple Lie algebras, see e.g. B.G. Wybourne, Classical Groups for Physicists, 1974, p. 142. 
A: Although the two definitions you give are largely equivalent for semisimple Lie algebras, in general they are not. As mentioned in the comments, it is often that people consider non-quadratic Casimir elements, that can be cubic or higher polynomials, or even rational or trascendental functions. (See for example https://iopscience.iop.org/article/10.1088/0305-4470/27/8/016 )
But in the other direction, it can also happen that there are no Casimir operators. This fails even for the simplest case: there is a unique nonabelian Lie algebra of dimension 2, given by $[x,y]=x$. The Killing form here is simply the zero matrix, so that the only "quadratic Casimir operator" is in fact zero (which doesn't "count", in the sense that we have no generators). Papers like the one in the above link show that in fact the number of generalized Casimir invariants is zero, so we have no linear or cubic or any other invariants.
Semisimple Lie algebras have nondegenerate Killing form, which is why Vibert's argument works in those cases.
