F(S) is called the structure factor because it depends on the arrangement (structure) of the atoms in the unit cell, and is defined as the ratio of the radiation scattered by any sample (atoms or molecules) to that scattered by a single electron at the origin.
The structure factor F(hkl) of any X-ray reflection (diffracted beam) hkl is the quantity that expresses both the amplitude and the phase of that reflection. It plays a central role in the solution and refinement of crystal structures because it represents the quantity related to the intensity of the reflection which depends on the structure giving rise to that reflection and is independent of the method and conditions of observation of the reflection. The set of structure factors for all the reflections hkl are the primary quantities necessary for the derivation of the three-dimensional distribution of electron density, which is the image of the crystal structure, calculated by Fourier methods.
From: Introduction to the calculation of structure factors, S. C. Wallwork
The sum over j from 1 to n is for j atomic scattering contribution.
Because electrons are not localized, we describe an electron density ρ(r) in a volume dr, thus the scattering is proportional to ρ(r)dr.
For a continuous electron density at position r:
ρ(r)dr corresponds to the number of electrons in the volume dr. If we have many discrete scatterers, the structure factor will be a sum over many terms, and for a continuous electron distribution this sum is replaced by an integral:
This is the single fundamental equation that governs all X-ray scattering and diffraction.
See this page for a good (better) explanation.