I own a Construction company with permanent offices in three states. We do 300 to 500 roof replacements per year, mostly insurance funded. Check out the following:
Must have General Liability and Workman's Compensation insurance. Require them to provide a cert, make sure they're listed for roofing.
Google reviews and Angie's List. Check local BBB to see if they've had many complaints.
Ask for five local references who they've done work for in the past six months.
Did they have someone get on the roof to look it over? Unless it is an incredibly simple roof, disqualify those who didn't.
It would be rare for the cheapest to be the best.
Ask them about code items and how they'll address that. Valley lining, drip edge, cricket for chimney if needed and ventilation. If they go "huh?", disqualify them.
How long have they been in business? Beware of anyone less than 2 years old.
Minimum of 5 year workmanship warranty.
Most roofing companies use subs these days. I wouldn't worry about that. Ask how long their sub had been working for them. Sub should also have GL and WC insurance.
A deposit of 50% is fine and customary. If concerned, offer to give it to them the day of the job when the materials have been delivered. A decent company shouldn't require your money to buy materials.
If you have any questions, feel free to PM me. Good luck.