The first thing to check is whether or not the plant has any signs of disease.
There are a number of ways to tell. One of the most reliable is the color of the tomato. If it's dark green, it's probably ok. If it's light green, it may be starting to decay. If it's yellow or brown, it's most likely too far gone. Another way is to press your thumb on the stem of the tomato and see how it feels. If it's waxy, it's ok. If it's dry and hard, it's dead.
You can look at the underside of the leaves. If the leaves have turned yellow, this is a sign of bacterial wilt.