Under what conditions can we find a basis of a Lie algebra such that the adjoint representation acts by skew-symmetric matrices? My question might be very silly as I've only recently started to learn about Lie algebras.
Given a Lie algebra $\mathfrak{g}$, and a vector space basis $\{e_i|i=1 \ldots \dim \mathfrak{g}\}$, we can write the adjoint action $\text{Ad}_x: \mathfrak{g} \to \mathfrak{g}: y \mapsto [x,y]$ in matrix form, where the $i,j$th entry of the matrix $[\text{Ad}_x]$ equals $\lambda_i$ if $[x,e_j] = \sum_{k}\lambda_k e_k$. I am looking for necessary and sufficient conditions on our Lie algebra $\mathfrak{g}$ such that there exists a basis in which all of these matrices $\{ [\text{Ad}_x]| x \in \mathfrak{g} \}$ are skew-symmetric.
If the condition turns out to be either simplicity of compactness of the associated simply connected Lie group, I would be very happy.
 A: $\DeclareMathOperator{\tr}{tr}\DeclareMathOperator{\ad}{ad}$I will expand my comment here. I am assuming (though I am not sure if this is the case) that the OP is interested in real Lie algebras. If $\mathfrak{g}$ is the Lie algebra of a compact semisimple Lie group, then with respect to any orthonormal basis of $\mathfrak{g}$ with respect to (minus) the Killing form, the matrix representing $\operatorname{ad}_x \in \mathfrak{gl}(\mathfrak{g})$ is skew-symmetric, for any $x \in \mathfrak{g}$.
Define the Killing form $B(-,-): \mathfrak{g} \times \mathfrak{g} \to \mathbb{R}$ by:
$$B(x,y) = \tr(\ad_x \circ \ad_y).$$
I claim that for any $z \in \mathfrak{g}$, $B([z,x],y) + B(x,[z,y]) = 0$. For short, it is common to say that the Killing form is $\ad$-invariant.
$$ \begin{align*} & B([z,x],y) + B(x,[z,y]) \\
    = & \,\tr(\ad_{[z,x]} \circ \ad_y)+
    \tr(\ad_x,\ad_{[z,y]}) \\
    = & \,\tr([\ad_z,\ad_x] \circ \ad_y) + \tr(\ad_x \circ \, [\ad_z, \ad_y]) \\
    = & \,0 \end{align*}$$
by the cyclic property of the trace ($\tr(BCA) = \tr(ABC)$). I have also used the fact that $\ad_{[x,y]} = [\ad_x,\ad_y]$.
There is another fact from Lie theory that we need, namely that if $\mathfrak{g}$ is the Lie algebra of a compact semisimple Lie group, then its Killing form is negative definite.
Let us now choose an orthonormal basis of $\mathfrak{g}$, say $x_1,\ldots,x_n$, with respect to minus the Killing form. Note that, for any $x \in \mathfrak{g}$, we have
$$ -B(\ad(x)(x_i),x_j) = -B([x,x_i],x_j) = B(x_i, [x,x_j]) = B(x_i, \ad_x(x_j)).$$
Hence the matrix representing $\ad_x$ with respect to the orthonormal basis $x_1,\ldots,x_n$ is skew-symmetric.
A: Malkoun's beautiful answer shows that for a semisimple real Lie algebra, a sufficient criterion for such a basis to exist is that the Lie algebra is anisotropic, i.e. what in the real case is commonly called "compact", i.e. the corresponding Lie groups are compact.
I just want to point out that for semisimple real Lie algebras $\mathfrak g$, this is also necessary (as alluded to by Tsemo Aristide in the answer to this related question). Namely, if a real semisimple Lie algebra is not anisotropic (compact), then it contains elements $x \neq 0$ which are ad-diagonalisable, i.e. such that $ad(x)$ has non-zero real eigenvalues. However, all eigenvalues of real skew-symmetric matrices are purely imaginary, so there can be no basis of $\mathfrak g$ in which all $ad(x)$ are skew-symmetric.
Incidentally, Malkoun's answer can also be used to show that somewhat surprisingly, the result is true for all complex semisimple Lie algebras $\mathfrak g$. Namely, it is a classical cornerstone of the theory that for each such $\mathfrak g$ there exists a (unique) compact real form, i.e. an anisotropic real semisimple Lie algebra $\mathfrak g_0$ such that the scalar extension $\mathbb C \otimes\mathfrak g_0$ is isomorphic to $\mathfrak g$. Now take an orthonormal (real) basis $e_1, ..., e_n$ of $\mathfrak g_0$ w.r.t. its Killing form as per Malkoun's answer, and the matrices of all the adjoints to those elements will be skew-symmetric. Now all elements of $\mathfrak g$ are $\mathbb C$-linear combinations of elements of $\mathfrak g_0$, hence the matrices of all $ad(x), x \in \mathfrak g$ in the basis $1 \otimes e_1, ..., 1 \otimes e_n$ will be skew-symmetric (complex) matrices. (Note that what I wrote in my second paragraph does not contradict this, as complex skew-symmetric matrices can have all eigenvalues one could want, as long as they add up to $0$.)
A: The problem has haunted me for the last couple of weeks, and I want to add another answer:
Let's assume our Lie algebra $\mathfrak g$ is of finite dimension $n$ over a field $k$. The computation in Malkoun's answer shows that the question is equivalent to:

Does there exist a (symmetric, nondegenerate) $ad$-invariant bilinear form on $\mathfrak g$ that in some basis is represented by the identity matrix $Id_n$, i.e. such that the corresponding quadratic form is equivalent to $q_{st} (x_1, ..., x_n) =x_1^2 + x_2^2 + ... + x_n^2$?

Now let $\mathfrak g$ be absolutely simple over a field $k$ of characteristic $0$. Then it's well-known that if $b: \mathfrak g \times \mathfrak g \rightarrow k$ is any $ad$-invariant, nondegenerate bilinear form, then there is $c \in k^*$ such that $b(x,y) = c \kappa(x,y)$ for all $x,y \in \mathfrak g$, where $\kappa(\cdot, \cdot)$ is the Killing form. So our question becomes whether or not the Killing form, up to scalar multiple, is represented by $Id_n$.
(NB. For symmetric BLFs/ quadratic forms one usually looks at the equivalence relation on $M_n(k)$ given by
$$ A \simeq B :\Leftrightarrow \exists P \in M_n(k): A= P^TBP$$
and says A, B are congruent. Here, we are looking at the "coarser" equivalence relation $$ A \sim B :\Leftrightarrow \exists c \in k^*, P \in M_n(k): A=cP^TBP$$
This comes up a lot in the study of classical Lie algebras. I think Jacobson called two such matrices "cogredient", but I don't think that has become standard nomenclature. Elman/Karpenko/Merkurjev in The Algebraic and Geometric Theory of Quadratic Forms call it "similar". For now I will just say "congruent up to scalars".)
Now to decide whether this is the case for a given absolutely simple Lie algebra over a specific field can become quite intricate, and can depend a lot on both the Lie algebra and arithmetic of the field. The answers given for $\mathbb R$ and $\mathbb C$ are, in way, very good cases.
First off, the assertion is true if $k$ is quadratically closed (in particular, if $k$ is algebraically closed), because then, $q_{st}$ is the only quadratic form up to congruence (we don't even need scalar multiples there).
Over $\mathbb R$, via Sylvester's law of inertia, the only scalar multiples of $q_{st}$ up to congruence are $\pm q_{st}$, which are up to congruence the only definite quadratic forms there; i.e. our question is equivalent to deciding whether the Killing form is definite, and it is well-known that it is iff $\mathfrak g$ is a compact form.
For other fields, however, things might get tough. Let's just look at the
Easiest example $\mathfrak g:= \mathfrak{sl}_2(k)$
Since this Lie algebra (of dimension $n=3$) contains non-trivial $ad$-nilpotent elements, the Killing form contains isotropic vectors. A necessary condition for our assertion is therefore that there are $(0,0,0) \neq (x,y,z) \in k^3$ such that $x^2+y^2+z^2=0$. Actually, the theory of quadratic forms also shows that this is sufficient. Indeed, one can do this with explicit matrix computations: W.l.o.g. assume there are $x \in k, y \in k^*$ with $x^2+y^2+1=0$. Then
$$e_1 := \pmatrix{-\frac{1}{y}&\frac{x}{y}\\\frac{x}{y}&\frac{1}{y}} , e_2 := \pmatrix{-\frac{x}{y}&-\frac{1}{y}\\-\frac{1}{y}&\frac{x}{y}} , e_3 := \pmatrix{0&1\\-1&0}$$
form a basis of $\mathfrak{sl}_2(k)$ which is "orthonormal" with respect to $-\frac{1}{8}$ times the (isotropic) Killing form. (Note e.g. the special case that $k$ contains a square root of $-1$ called $i$: Then we can set $x=0$, $y=i$ and get $$e_1=\pmatrix{i&0\\0&-i}, e_2 = \pmatrix{0&i\\i&0}, e_3 = \pmatrix{0&1\\-1&0}$$
a standard basis of the compact real $\mathfrak{su}_2$ as well as $\mathfrak{sl}_2(\mathbb C)$, matching previous result for those fields.)
But for which fields there exist such $x,y (,z)$ is a non-trivial problem in general! E.g. while all extensions of some $p$-adic field $\mathbb Q_p$ for odd primes $p$ do, and also all seven quadratic extensions of $\mathbb Q_2$, the $2$-adic numbers $\mathbb Q_2$ themselves do not, and for other extensions of $\mathbb Q_2$ the answer seems to be hard to find.
Meaning that e.g. all $\mathfrak{sl}_2(\mathbb Q_p)$ for odd $p$ have bases for which all matrices representing the adjoint action are skew-symmetric, but there is no such basis for $\mathfrak{sl}_2(\mathbb Q_2)$.
Further, we can easily see that for any number field $k$ which can be embedded into $\mathbb R$, $\mathfrak{sl}_2(k)$ has no such basis (this generalises to any non-anisotropic form over any formally real field); certainly over many other number fields $k$ (trivial example $k=\mathbb Q(i)$), $\mathfrak{sl}_2(k)$ does have such a basis; but for example $\mathfrak{sl}_2(\mathbb Q(\sqrt{-7}))$ does not, as it embeds into $\mathbb Q_2$.
Now $\mathfrak{sl}_2$ can have other forms over fields, the classification of which is equivalent to that of division quaternion algebras over those fields. If $k$ is a finite extensions of some $\mathbb Q_p$, up to isomorphism there is only one, just like over $\mathbb R$. We call it
$\mathfrak{su}_2$ (over a $p$-adic field $k$)
Its elements are of the form $$\pmatrix{r\sqrt{a}&s+t\sqrt{a}\\b(s-t\sqrt{a})&-r\sqrt{a}}$$ where $r,s,t \in k$, and $a,b$ are chosen such that the quadratic form $X_0^2-aX_1^2-bX_2^2+abX_3^2$ is anisotropic (up to congruence, there is exactly one anisotropic quadratic form in four variables over $k$). One can check that the Killing form of $\mathfrak{su}_2$ is anisotropic again, and up to scaling is congruent to the unique (up to scaling) anisotropic quadratic form in three variables over $k$, which is $X_0^2-aX_1^2-bX^2$.
But our previous results showed that for all $p \neq 2$ (and also for any quadratic extension of $\mathbb Q_2$), the form $q_{st}$ is isotropic over $k$, so it cannot be congruent up to scaling to that Killing form! (Whereas conversely for odd degree extensions of $\mathbb Q_2$, it is the unique-to-scaling anisotropic form with $a=b=-1$). This means that for all $\mathbb Q_p$ ($p$ odd) the forms of $\mathfrak{sl}_2$ behave exactly the other way than over $\mathbb R$: The compact one cannot be written as skew-symmetric matrices, but the split one can!

Finally, note that although some of the above arguments generalise, some of them do not even generalise to $\mathfrak{sl}_3$: At some steps above I implicitly used that quadratic forms in three variables are still relatively easy to handle (in particular, up to scaling there is exactly one isotropic one). Another way to think of the $\mathfrak{sl}_2$-forms is in terms of isos of split or non-split forms of $\mathfrak{sl}_2$ and $\mathfrak{so}_3$, respectively. Any non-zero map between these is an isomorphism, for dimension reasons, so one is compact iff the other is. This line of argument would also break down already for forms of $\mathfrak{sl}_3$. For higher dimensions, one needs to know more about the Witt groups of specific fields than I do.
