I am trying to learn Lie theory and for this purpose I worked out the Lie algebras of some matrix groups. The examples I worked happened to be complex matrix groups and it lead me to wonder whether, when I try to determine a basis, I had to find a complex or a real basis.
Is there any convention, definition or otherwise a way to know whether a Lie algebra is to be understood as a complex or real vector space?
A real Lie algebra is a real vector space and a complex Lie algebra is a complex vector space. Standard notations for standard Lie algebras usually implicitly specify which is which; for example, $\mathfrak{gl}_n(\mathbb{R})$ is naturally a real Lie algebra while $\mathfrak{gl}_n(\mathbb{C})$ is naturally a complex Lie algebra. If the author does not specify then you need to figure out which is intended from context.
Two warnings: $\mathfrak{u}(n)$ is a real Lie algebra. It does not have a natural complex structure. And people frequently take complexifications $\mathfrak{g} \otimes_{\mathbb{R}} \mathbb{C}$ of real Lie algebras, e.g. when determining their complex representation theory.