Why are there spectral lines at all?
At your level of understanding, the Bohr atom will do.
Atoms are neutral, composed of orbiting electrons ( negatively charged) around a nucleus (positively charged).
The very basic question coming out of this fact, that an atom is composed of orbiting electrons around a positive nucleus is: how can it be possible when we know that accelerating charges makes them radiate electromagnetic waves away and lose momentum. The electrons should fall into the nucleus since a circulating charge has a continuous acceleration, and matter as we know it could not exist.
Enter the Bohr model: It postulated that there were some orbits where the electrons could run around without losing any energy , quantized orbits.
Enter the absorption lines: The electrons could only change orbits if kicked up by an electromagnetic wave of an energy specific to that particular orbit and discrete. There fore if one shone that specific frequency of light ( E=h*nu) on a specific atom there was a probability to kick an electron up to a higher, called excited, orbit.
Enter the emission lines: Once excited there was a probability for the electron to fall back emitting the specific energy it had absorbed before. This could be observed.
Different experiments will show the different behaviors, even though absorption and emission will be happening continuously in the material.
An experiment shining light on the material and looking at the reflected spectrum will see absorption lines at those frequencies, because the relaxation of the excited electrons will emit back radiation all around randomly, whereas the reflected spectrum is at a specific angle.
An experiment out of the line of the exciting photons will see the emission spectrum . Absorption spectra are useful for identifying elements in stars, the absorption happening in the star's atmosphere and appearing as dark lines in the black body spectrum.
It goes without saying that physics has moved to new horizons from the time that the Bohr atom was news. It has been supereceded by Quantum mechanics which gives tools to accurately predict and classify all spectra as the result of a coherent theory of the way the universe behaves ( i.e. quantum mechanically).
A spectral line is associated with a pair of levels of an atom with energies $E_1\lt E_2$. Typically, unless we deal with fancy lasers etc., the number of atoms at the level $E_2$ is smaller than the number at the level $E_1$ – because Nature struggles to save energy. The ratio is given by $\exp(-\Delta E/kT)$, by the universal laws of statistical physics.
So a general system displaying absorption or emission is described at least by one parameter, the occupation number ratio for the higher level and the lower level. There is one more important parameter – the density of photons $N$ in the appropriate state with the relevant frequency. If there are no photons to start with, there can't be any absorption. There is nothing to absorb.
The general rules based on the quantum harmonic oscillators imply that the probability of absorption if there are $N$ photons is proportional to $N$ while the probability of emission if there are $N$ photons to start with is $N+1$. These two statements are related by the time-reversal symmetry; there is $N+1$ instead of $N$ because it's the number of photons in the final state which is the time-reversal partner of the initial state from the case of the absorption.
Also, $N+1$ may be interpreted as the sum of $N$, the stimulated emission, and $1$, the spontaneous emission. These rules were already known to Einstein almost a decade before the birth of quantum mechanics.
So if the initial system has lots of photons in the right frequencies and a relatively small number of excited atoms, the absorption – accompanied with the excitation of many unexcited atoms – will dominate. On the contrary, if you place many atoms (with a high enough proportion of the excited ones) to an environment without light, the emission will exceed absorption. These ratio of the emission and absorption rate is easy to calculate.
In all cases, you may view the excess of absorption or excess of emission to be examples of the second law of thermodynamics – heat is flowing from a warmer body to a cooler one. The two objects are the set of atoms and the electromagnetic field (its relevant modes). If the temperature of the atoms (given by the ratio of the occupation numbers for excited and unexcited states) is higher than that of the electromagnetic field (given by the number of the photons), heat will flow from atoms to the electromagnetic field. Nature tries to reach equilibrium.
Also, one atom may absorb and another one may emit. Alternatively, photons with one direction or polarization may be absorbed while photons with another direction or polarization may be emitted. So both processes may occur – and may be independently observed – at the same time. If you needed more details, you would have to be more specific about the experiment in which those two things occur at the same time.