The stellar abundance analysis frequently relies on the local thermodynamic equilibrium (LTE) assumption for spectral line formation. This assumption is not always appropriate, in particular, for metal-poor and/or evolved stars. To better understand these stars and contrain their impacts in the chemical enrichment of the Galaxy, it is necessary to use a non-LTE (NLTE) description more realistic but also more complex to built up. My thesis work consisted in constructing model atoms from the most recent atomic databases for two α-elements: the magnesium and the calcium. These elements are astrophysically interesting because they permit us to characterize the chemical enrichment of stellar populations. I therefore developed a model atom construction code, FORMATO, to study the NLTE formation of spectral lines. I used these models for computing a grid of NLTE corrections to apply to the equivalent widths of the principal spectral lines of these elements, whose several will be observed by the Gaia mission, for giants and super-giants. I also applied these results to the NLTE limb-darkening laws for the CaII IR triplet which permit to determine, for the first time, the chromospheric extent of the red giant β Cet, using interferometric observations (VEGA@CHARA). Finally, in the context of the Carina Project, I highlighted NLTE effects on ionization equilibrium of iron (~0,1 dex) in a sample of 44 red giant stars in the Carina dSph galaxy, thanks to a comparative study between FeI and FeII lines in LTE and NLTE.