Chemical abundances as measured from stellar spectral lines are often subject to uncertainties due to lack of accurate data for inelastic collisions, which is needed for non-local thermodynamic equilibrium (non-LTE) modelling. For cool stars, understanding of collision processes with electrons and hydrogen atoms is required to achieve high precision measurements. In this thesis, I have investigated the role of these collisions on the non-LTE formation of Li and Mg spectral lines in late-type stars.In the case of Li, electron impact excitation processes were calculated using the R-matrix with pseudo states method and the results found to agree well with recent calculations using the convergent close-coupling technique. These modern data were employed in non-LTE calculations by updating an existing model atom, which already included modern data for hydrogen collision processes. Our results were compared with calculations using older semi-empirical approximation calculations and only small differences were found: about 0.01 dex (~ 2%) or less in the abundance corrections. We therefore conclude that the influence of uncertainties in the electron collision data on non-LTE calculations is negligible. Indeed, together with the collision data for the charge transfer process Li + H ↔ Li+ + H- now available, and barring the existence of an unknown important collisional process, the collisional data in general is not a source of significant uncertainty in non-LTE Li line formation calculations.In the case of Mg, electron impact excitation processes were again calculated with the Rmatrix with pseudo states method, and used together with recent hydrogen collision calculations to build and test a model atom, without free parameters, for non-LTE modelling. Both electron and hydrogen collision processes, including charge transfer and excitation, are found to be important thermalising agents in various cases. The modelled spectra agree well with observed spectra from benchmark stars in the optical and infrared. The modelling predicts non-LTE abundance corrections ∆A(Mg)NLTE–LTE in dwarfs, both solar metallicity and metal-poor, to be very small (of order 0.01 dex), even smaller than found in previous studies. In giants, corrections vary greatly between lines, but can be as large as 0.4 dex. Results of calculations in a large grid of 1D model atmospheres are presented, and the implications for studies of Mg discussed. The propagation of uncertainties in the inelastic collision data to those in stellar abundances is investigated, and found to lead to small uncertainties, once again typically less than 0.01 dex (2%), although for few stellar models in specific lines (e.g., metal-poor suns, in the 7691 A line) uncertainties can be as large as 0.03 dex (7%).