How can we write the elements of a free Lie algebra? Is there any reference concerning this subject?
The key words are "Lyndon words". A reference is Free Lie Algebras by C. Reutenauer. 


Yes, as was said previously the key is Lyndon words and the reference is Reutenauer's book "Free Lie algebras". Your free Lie algebra reads $L_R<X>$ where $X$ is an alphabet (i.e. a set) and $R$ is a unitary ring. If your (free Lie) algebra is given by $L(V)$ where $V$ is a free module over $R$, take for $X$ any basis of $V$. Now you need :
Addition. This algorithm has many applications. One of them is to compute the multiplication table of the Free Lie algebra (combinatorial problem still open) i.e. the structure constants $$ [P_{l_1},P_{l_2}]=\sum_{l\in Lyn(X)}\gamma_{l_1,l_2}^l\,P_l $$ 


"Lie Algebras: Theory and Algorithms" by Willem A. De Graaf has a chapter dealing with the more general problem of explicit construction of a basis of a finitely presented Lie algebra (free Lie algebra modulo an ideal), perhaps it is what you are looking for. 

