I am confused about how hot surfaces can radiate light to their surroundings. When I shine a light on a surface the light turns to heat spontaneously, and when I leave that hot surface it radiates light spontaneously. To me this suggests that the process isn't driven by entropy increasing because it is two directional. Could anyone explain how this process complies with the second law of thermodynamics?
Heat, in the context of something "giving off heat" that we use in everyday conversation, is a term we use often to describe emission of a specific part of the electromagnetic spectrum (namely the infrared spectrum). As you start to pour more and more energy into an object, the electrons can get more and more excited (which is the process of absorbing photons), until they emit a photon to return to a lower energy state. As you get hotter the electron can jump up further and further until when it returns to the ground state it emits visible (or UV/x-ray) photons.
In terms of entropy and the second law, when shining the light on a surface, the electrochemical processes occurring in the flashlight results in a greater amount of entropy since the chemical concentrations of the battery cells increase in the number of micro-states. Similar would be true of whatever is driving the light emission from your source. When the energy is emitted from the surface, heat is flowing from a hot source to a colder one, increasing the number of potential states (multiplicity) and thus entropy of the entire system. Throughout the entire process entropy is having a net increase if you observe the entire system.
Could anyone explain how this process complies with the second law of thermodynamics?
The Stefan-Boltzmann law.
I'll start with an ideal black body. Black bodies absorb all incoming radiation. They also emit radiation as a function of temperature. The peak frequency and the intensity increase as temperature increases. The emitted power is given by the [Stefan-Boltzmann law](Stefan–Boltzmann law), $P=A\sigma T^4$, where $A$ is the surface area of the black body, $\sigma$ is the Stefan–Boltzmann constant, and $T$ is the body's temperature. Now let's put the body in empty space, well-removed from any other radiating object. The body loses energy thanks to this radiation and hence suffers a dropping temperature. It also receives incoming energy from the cosmic microwave background radiation. The incoming and outgoing energy balance when the object finally cools to 2.73 Kelvin, the temperature of the CMBR.
Now let's look at a pair of flat plates, each one of which is a perfect white body (or perfect mirror) on one face, a perfect black body on the other. White bodies and perfect mirrors neither absorb nor emit heat radiation. We'll arrange the bodies so their black body faces face each other. This arrangement means they aren't radiating into space. Suppose the plates have different temperatures. Per the Stefan-Boltzmann law, the hot plate will radiate more energy than will the cold plate. The hot plate will cool down and the cold plate will warm up. The process stops when the two plates are at the same temperature.
Those were spherical cows, but even with realistic bodies, thermal radiation always operates in concordance with the second law.
I never said why that final sentence is the case. Objects coming into thermal equilibrium with one another is the second law of thermodynamics in action. The entropy of an isolated system reaches its maximum value when all elements of the system are in thermal equilibrium with one another.
One of the many statements of the second law is that heat cannot spontaneously flow from a colder body to a warmer one. If heat can flow between two objects, the heat flow will always be from the warmer object to the cooler one. Radiative heat transfer is but one of many mechanisms by which heat spontaneously flows from a warmer object to a cooler object.