In a nutshell:
The A-50 exists in very limited numbers, and has very limited performance as a radar warning system, compared to similar western planes. The Ukrainians launched an aggressive operation against Russian ground-based radars in the south. This then forced the Russians to send up one of their few A-50s to make up the radar shortfall in that region.
Because the A-50's performance is lacking, the Russians were further forced to operate it dangerously close to the front lines. The Ukrainians had previously an S-300 surface-to-air missile system close to the front line, to lie in wait for the A-50. Once the Ukrainians knew the plane was in range, they shot it down.
That's the hypothesis, anyway. Sounds reasonable to me.
---
Another reasonable-sounding hypothesis is that the Patriot system can fire missiles that home in on enemy radar signals. They fire the missile in the direction where they expect the plane to be, and the missile itself finds the plane and targets it, rather than relying on the Patriot's ground-based radar. This supposedly increases the Patriot's range five-fold, but with a much lower hit probability. The lower hit probability can be offset by really good reconnaissance that tells you pretty accurately where to send the missile, so that it finds the plane. If the Ukrainians are getting really good recon data from NATO, well.