In scattering, how does a particle 'know' which direction it is being illuminated from?
It is momentum that defines the incoming direction and momentum transfer the outgoing one.
The photons, quantum mechanically carry momentum equal to p=h*nu/c . Momentum is a vector and defines directions.
An electromagnetic field is an emergent classical quantity built up by innumerable photons.
There exists also a momentum defined for the classical field where the Poynting vector defines the direction, if one ignores the quantum dimensions, but you are talking of electrons which are quantum mechanical elementary particles.
Let me offer you a slightly modified version of your question to illustrate a way of re-formulating it your thought process.
How does a pool ball know from which direction the cue ball hit it?
The answer is the same in the sense that "the particle" does not know all by itself, "the system"1 has certain invariant quantities (like momentum and energy) and some of those are vectors and have directions built in. Just like the cue ball, the incident light carries energy, momentum and angular momentum and those conserved quantities must be respected by final state of the system.
This approach is, perhaps, more natural if you use a quantized (i.e. photons) picture of light but it still applies with a classical view in which the energy and momentum input is continuous.
1 That is the "the particle" and the incident light or the combination of the two pool bals.