There are three ways. Which one matters is related to increasing photon energy.
You might remember that the photoelectric effect is concerned with the total absorption of an incident photon of visible or perhaps UV light in a metal surface with the consequent emission of an electron. This is a low energy phenomenon and obviously the energy acquired by the electron is dependent on the initial photon energy, rapidly diminishing in importance as initial photon energy increases.
At higher photon energies such as with X rays an inelastic event may occur, called Compton Scatter. A free electron takes up part of the photon energy, the photon is scattered or re-emitted with a longer wavelength and the difference is in the kinetic energy of the electron scattered in a different direction.
By contrast to the photoelectric effect, Compton scatter doesn’t vary much with incident photon energy, but increases linearly with atomic number. Scattered electron is seen on the diagram as a black arrow.
Just for completeness, at higher energies still we see Pair Production being dominant where the photon is converted into an electron-positron pair.
So, at low Z and relatively high energy, mostly Compton scattering, low energy and high Z means the photoelectric effect predominates and high energy and high Z means Pair Production. Notice the logarithmic scale on the energy axis.