If you run into the car in front of you, you are nearly always considered partly responsible: as you should be keeping a safe distance behind the vehicle in front.
But sometimes the driver of the car that gets rear ended is at fault, for example in these scenarios, reversing suddenly; driving with broken brake lights; breaking down and not switching on hazard lights or not moving out of the lane of traffic. From a legal perspective, there could be many facets of the situation that would have to be considered.