The way to calculate the action of $C$ is to make a smart choice of dual bases and then observe that it suffices to check the action of $C$ on a highest weight vector. (The fact that you use the trace form rather than the Killing form shows up only in an overall scaling of $C$.) Basically, you have to observe that the Cartan subalgebra $\mathfrak h$ is orthogonal to all root spaces with respect to $B$ while for two roots $\alpha$ and $\beta$, the restriction of $B$ to $\mathfrak g_{\alpha}\times\mathfrak g_{\beta}$ is non-zero if and only if $\beta=-\alpha$. First choose a basis $\{H_i\}$ of the space $\mathfrak h$ of diagonal matrices which is orthonormal with respect to $B$. Next, for $i<j$ consider the elementary matrix $E_{ij}$. Then it follows that $\{E_{ij}^t,H_i,E_{ij}\}$ is a basis of $\mathfrak{sl}(n,\mathbb C)$ with dual basis $\{E_{ij},H_i,E_{ij}^t\}$. Otherwise put, you get
$$
C=\sum_{i=1}^{n-1}H_iH_i+\sum_{i<j}(E_{ij}^tE_{ij}+E_{ij}E_{ij}^t).
$$
Acting with an element in the second sum on any representation $V$, you get for $v\in V$:
\begin{align*}
E_{ij}^t\cdot E_{ij}\cdot v+E_{ij}\cdot E_{ij}^t\cdot v=&2E_{ij}^t\cdot E_{ij}\cdot v+(E_{ij}\cdot E_{ij}^t\cdot v-E_{ij}^t\cdot E_{ij}\cdot v)\\
=&2E_{ij}^t\cdot E_{ij}\cdot v+[E_{ij},E_{ij}^t]\cdot v.
\end{align*}
Since you know in advance that $C$ has to act by a scalar on any irreducible representation, it suffices to compute $C\cdot v_0$ for a highest weight vector $v_0\in V(\lambda)$. But by Definition $E_{ij}\cdot v_0=0$ and for $H\in\mathfrak h$, we get $H\cdot v_0=\lambda(H)v_0$. Hence you get
$$
C\cdot v_0=\left(\sum_{i=1}^{n-1}\lambda(H_i)^2+\sum_{i<j}\lambda([E_{ij},E_{ij}^t])\right)v_0.
$$
The scalar can be expressed as $\langle\lambda,\lambda\rangle+2\langle\lambda,\rho\rangle$, where $\rho$ is half of the sum of all positive roots and the inner product is induced by $B$.
Something which none of the other answers mentioned is that, assuming OP means $J_0=\sigma_1,J_1=\sigma_2,J_2=\sigma_3$, and $J_\pm=J_1\pm iJ_2$ or something like that, neither is actually a basis of $\mathfrak{su}(2)$.
My personal opinion is that none areas of mathematics are as butchered by the physicist's usual lack of precision as representation theory is. It is not always a problem, but it's nontheless good to get it right sometimes.
So first of all, the Lie algebra $\mathfrak{su}(2)$ consists of traceless, antihermitian matrices. The Pauli matrices are hermitian. But for example, let's define $$ T_i=-\frac{i}{2}\sigma_i, $$ then $$ [T_i,T_j]=-\frac{1}{4}[\sigma_i,\sigma_j]=-\frac{1}{4}2i\epsilon_{ijk}\sigma_k=-\frac{i}{2}\epsilon_{ijk}\sigma_k=\epsilon_{ijk}T_k. $$
Then the system $T_1,T_2,T_3$ does provide a basis for $\mathfrak{su}(2)$.
Secondly, despite the involvement of matrices with complex entries, $\mathfrak{su}(2)$ is a real Lie algebra, because the antihermiticity condition is not invariant under multiplication with $i$.
If we allow multiplication of elements with $i$, we get the set of all traceless matrices, which is $\mathfrak{sl}(2,\mathbb C)$, which I'll be considering as a complex Lie algebra (taken this way, $\mathfrak{sl}(2,\mathbb C)$ is the "complexification" of $\mathfrak{su}(2)$).
Thus, if complex linear combinations are allowed, then $(T_1,T_2,T_3)$, $(J_0,J_1,J_2)$, $(J_0,J_
+,J_-)$ etc. are all valid generators of $\mathfrak{sl}(2,\mathbb C)$.
I am noting here that $\mathfrak{sl}(2,\mathbb C)$ can also be "decomplexified" to obtain a real Lie algebra of dimension 6. For example if $T_1,T_2,T_3$ are the three antihermitian matrices I have written above, then $\mathfrak{sl}(2,\mathbb C)_\mathbb R$ is a real Lie algebra of dimension 6 whose generators can be taken to be say $T_1,T_2,T_3,iT_1,iT_2,iT_3$.
In the physics literature, for unitary Lie algebras, the generators are often taken to be hermitian rather than antihermitian because quantum mechanics prefer hermitian operators, and in many cases, complexifications and decomplexifications are left implicit and unmentioned and people will just happily multiply by $i$ without giving a second thought. But it should be noted that most matrices that are called the generators of $\mathfrak{su}(2)$ cannot actually be taken to be generators of $\mathfrak{su}(2)$, but of its complexification $\mathfrak{sl}(2,\mathbb C)=\mathfrak{su}(2)_\mathbb C$. This is especially true for the ladder opeators $J_\pm$, as those involve complex linear combinations.
Best Answer
First, you are confusing Lie groups with Lie algebras. Casimir elements are objects that can be attached to certain Lie algebras.
Second, Casimir elements do not always exist. For any Lie algebra $\mathfrak{g}$, there is a canonical bilinear form, the Killing form
$$B(x, y) = \text{tr}(\text{ad}_x \text{ad}_y)$$
where $\text{ad}_x(y) = [x, y]$ is the adjoint action of $\mathfrak{g}$ on itself. The Casimir element exists if and only if the Killing form is nondegenerate, which is equivalent to $\mathfrak{g}$ being semisimple (in particular, finite-dimensional). Concretely this means that $B(x, -)$ is a nonzero linear functional for any nonzero $x$. Abstractly this means that the map $$\mathfrak{g} \ni x \mapsto B(x, -) \in \mathfrak{g}^{\ast}$$
(where $\mathfrak{g}^{\ast}$ is the dual space of linear functionals $\mathfrak{g} \to k$ for our base field $k$ of characteristic zero) is an isomorphism. For an abelian Lie algebra, the Killing form is identically zero, and so the Casimir element does not exist in that case.
In the semisimple case, the Killing form itself defines a linear functional $\mathfrak{g} \otimes \mathfrak{g} \to k$ (where $\otimes$ denotes the tensor product), or an element of $\mathfrak{g}^{\ast} \otimes \mathfrak{g}^{\ast}$, and because of the above isomorphism one can equivalently write the Killing form as an element of $\mathfrak{g} \otimes \mathfrak{g}$. This is the Casimir element.
Concretely, we can compute the Casimir element as follows. Given a basis $e_1, ... e_n$ of $\mathfrak{g}$, compute the Killing form $B$ using the structure constants of $\mathfrak{g}$, then compute the dual basis $f_1, ... f_n$, which is the unique basis satisfying $$B(e_i, f_j) = \delta_{ij}.$$
Then the Casimir element is given by $\sum e_i \otimes f_i$. Since you are aware of this definition, perhaps what you're stuck on is either computing the Killing form or computing the dual basis. For fixed $\mathfrak{g}$ both of these are fairly straightforward linear algebra. Which step are you having trouble with?