I came to this interesting question while discussing a related one: Do the gases in the Earth's atmosphere affect the color of a lunar eclipse?.
After thinking on the possible cause for this,"reversed" as compare to Earth, phenomenon I came to identify the directionality of Mie scattering as a possibility.
Digging a bit more to find corroborative material I have found this link that nicely explain the situation on Mars, and includes a truly beautiful comparison of photos of a red sunset on Earth and blue-ish sunset on Mars:
https://blog.briankoberlein.com/two-worlds-one-sun/
It is especially nice as it reviews the Rayleigh diffusion that is dominant in our atmosphere first, making it easier to understand the comparison to the optics of Mars' atmosphere. Moreover, after explaining the current answer it makes a point related to the question I mentioned above. So it even complements my answer to that.
Not to limit myself to a link-only answer, I would like to stress few points that will make the understanding even easier:
• while the intensity of Rayleigh scattering is very sensitive to wavelength, Mie scattering is normally relative agnostic to that.
https://en.m.wikipedia.org/wiki/Mie_scattering
However, it has a directional character, and particularly so when the particle have magnetic properties such those of the magnetite dust present in the atmosphere of Mars. In this case a remarkably forward vs backward scattering asymmetry can occurs, resulting in shorter wavelengths propagate straight as compared to longer ones.
https://www.osapublishing.org/josa/abstract.cfm?uri=josa-73-6-765
...unfortunately though, after a paywall.
This is what causes the blue sunset on Mars.
For sake of precision, martian midday has a more iyellow sky dome, then sky is progressively reddening til sunset arrives.
The point here is to correctly see the forward radiation as a scattered too, which semantically is not straightforward. The meaning is that the photons do indeed interact with the particle and are then diffuse along various directions. It just happens that in this particular Mie case the predominant one coincide or is a prolongation of the incident one.
As a curiosity, this link show a martian sky but in the Alps. While the NASA explains the bluish tint of sun on Mars by the forward scattering I mentioned above, it does not say if the mechanism is exactly the same in the alps case. It just mention the hard physics cause, i.e. Sahara's sand.
https://apod.nasa.gov/apod/ap210218.html
• always dealing with colour is important to recall that we are not dealing always with monochromatic light. In discussions such a this one we must keep in mind that the colours we perceived are always due to a particular spectral distribution and even a combination of other factors as brightness and contrast.
In terms of photons number the solar spectrum just out of our atmosphere, whatever we named its colour, is this:
Photon flux vs Wavelength, AM0
Whatever colour we perceive, the spectrum impinging to our retina is always what results after the source spectrum has been modified by the various phenomena occurring in between. A modified ratio at different wavelength can suffices for us to perceive different colours. Whose more interested can look for the CIE colour space, for instance
https://en.m.wikipedia.org/wiki/CIE_1931_color_space
I do apologize but I have no pictures editing tools aboard the little phone I am using right now
Edit: the end of my answer above covers the aspect of brightness and contrast. However it does so in a very general way as it applies to all circumstances.
A nice answer to the question would be combining the one above with that by Oscar Lanzi below. To which amount the various effects contribute to the observe facts remain opens, but we got an idea of the sunset colour reversal.