While people often claim that a rear-end collision is always the fault of the rear vehicle, that simply is not the case. Did you know that the first driver in a line, someone who merges into a line or others could be at fault as well? It's the reality that every situation is different, so the rear driver can't always be blamed.
Normally, it is the rear driver's fault when a collision happens. Why? They should have had the space and time to stop. It's their responsibility to keep several car lengths between them and the driver ahead of them. It's their job to slow to a stop if they approach a traffic signal or stop sign.
However, not every case is the same. Take, for example, a situation in which you hit someone who suddenly merges in front of you and uses their brakes. Since they merged suddenly and then applied their brakes, they didn't give you time to stop. You had no time to slow down, either. This tactic is sometimes used by drivers who want to get into a tail-end collision for the insurance payout, so be wary if someone suddenly brakes in front of you in this manner.
What should you do if you're in a rear-end collision that you think is the other driver's fault?
You should certainly tell the police that you believe it's the other driver's fault. You can explain what happened. For example, "The other driver merged from the right suddenly and then applied the brakes." The other driver might be cited with reckless driving, and you could walk away with the ability to make an insurance claim.