The number of times I've seen someone walk up to a bar (in a commercial gym) and just throw on some plates and start benching/squatting/deadlift without any sort of warm-up is more than the number of times Sam and Frodo share a "significant" look during the Lord of the Rings trilogy.
I cringe inside every time (because of the lack of warm-up and the significant looks).
First thing- know your first working weight. You don't set out on a road trip without a destination in mind, same thing with warming-up: have a destination in mind. The first working weight will also determine, roughly, how many warm-up sets you should have; obviously, the higher the starting weight, the more warm-ups are required.
Next- always do 5-10 reps with just the bar. This coordinates your brain and muscles to prepare to perform the movement, pump the blood around, and grease the groove of the movement. If the 1,000lb squatters start with the bar, so can you. The deadlift might be the only exception: I personally like to have my first warm-up weighted and pulling from the normal start position.
Now you can start loading plates. Let's take a fairly simple working weight of 200 pounds. Here's what a warm-up sequence could look like:
135 x 5
165 x 3
185 x 2
First work set
Let's say you're heading a bit higher- 300 pounds:
135 x 5
185 x 3
225 x 2
245 x 2
265 x 1
285 x 1
First work set
Those are just a few samples. There are a few rules to keep in mind that are helpful when deciding your warm-ups:
1. I've seen some people do 1 rep per warm-up and I've also seen folks rep out 10 reps every set. Neither are ideal. Earlier warm-up sets should have more reps 3-5; the last 2-3 sets (if you have that many) should be single reps.
2. Avoid enormous jumps in weight- the exception would be if it's only the second warm-up set- 50 lbs is probably the biggest jump I'd make at once. Unless you deadlift 500 lbs+, you have no business jumping from 135 to 225.
3. Speaking of jumps, you should make successively smaller jumps in weight as you approach your first work set. For example, don't make 10 pound jump followed by a 30 pound jump, that's just silly.
4. Use your warm-up sets to "take your temperature," so to speak. If the warm-up sets are feeling heavy and slow, it's probably a good idea to drop your first working set a bit and/or lower the intensity. On the flip side, if your warm-ups feel like their rocket-propelled, then think about increasing your working weight or the intensity of the lift.
Don't be a fool and skip your warm-up! Choose your warm-up weights based on your first working weight. Aim for at least 2-5 warm-ups, depending on how heavy you're working up to. Avoid large jumps in weight and performing too many reps each warm up set.