How do you know if you need to jump a car battery or replace it?

How do you know if y