One of the first steps in the development of quantum mechanics was Max Planck's idea that a harmonic oscillator (classically, anything that wiggles like a mass bobbing on the end of an ideal spring) cannot have just any energy. Its possible energies come in a discrete set of equally spaced levels.
An electromagnetic field wiggles in the same way when it possesses waves. Applying quantum mechanics to this oscillator reveals that it must also have discrete, evenly spaced energy levels. These energy levels are what we usually identify as different numbers of photons. The higher the energy level of a vibrational mode, the more photons there are. In this way, an electromagnetic wave acts as if it were made of particles. The electromagnetic field is a quantum field.
Electromagnetic fields can do things other than vibrate. For instance, the electric field produces an attractive or repulsive force between charged objects, which varies as the inverse square of distance. The force can change the momenta of the objects.
Can this be understood in terms of photons as well? It turns out that, in a sense, it can. We can say that the particles exchange "virtual photons" which carry the transferred momentum. Here is a picture (a "Feynman diagram") of the exchange of one virtual photon.

gif by Jack Sarfatti
The lines on the left and right represent two charged particles, and the wavy line is a virtual photon, which transfers momentum from one to the other. The particle that emits the virtual photon loses momentum p in the recoil, and the other particle gets the momentum.
This is a seemingly tidy explanation. Forces don't appear to happen because of any sort of action at a distance, they happen because of virtual particles that spew out of things and hit other things, knocking them around. However, this is misleading. Virtual particles are really not just like classical bullets.