There are two primary ways depending on the state of the electron:
1. For a free electron, an EM wave can be generated by simply accelerating the electron. The amplitude and frequency of the EM wave depends on the magnitude of the acceleration of the electron.
2. For an electron bound to an atom or molecule, it can emit an EM wave by dropping from a higher energy state to a lower energy state.
3. For bulk materials, the mechanism is a mix of 1 and 2. Electrons are accelerated by collisions with ions and other electrons and emit EM waves as a result. This is where thermal radiation comes from. In addition, a small amount will transition between energy states if the material has some sort of bandgap, emitting specific frequencies as a result. As far as I know, this happens mainly in semiconductors and insulators, not conductors. Semiconductor lasers rely on a version of this 2nd part to generate laser light.