Does the padding inside of a bicycle helmet contribute to the overall security of the helmet? I.e. do they cushion a crash in some way, or are they just there for comfort?
Because there is an optimum placement position for the helmet on the head, having padding that helps keep the helmet in place, or makes the helmet more comfortable to wear, indirectly contributes to the safety of the helmet. But aside from a very minor absorption of force during the moment of impact the padding really has no direct impact on the safety a helmet.
Modern bike helmets are designed to deform in a crash. Basically, the hard foam and plastic that the helmet is made out of, crumples during an impact. This dissipates the force of impact during a crash. For this reason it is important to replace your helmet after any significant impact. The padding is mostly there for comfort, and to make the helmet fit slightly better.
From the Bicycle Helmet Safety Institute "The spongy foam pads inside a helmet are for comfort and fit, not for impact protection"
Wadelp's post is the correct one -- the pads add nothing to crush/impact damage.
There is one factor that is worth considering and that has recently received more attention -- especially in the sports world -- and that is twist damage -- also known as rotational or shearing damage. That is, if you get a glancing blow from an object or if you hit the road and slide, your head and neck can receive considerable twisting (torsional) force unless the helmet can deflect it. Inside the skull, your brain can twist and tear at the brain stem.
What you want with glancing blows (or sliding on pavement) is the helmet to slide (which is one purpose for the external hard plastic layer) but the part next to you to not twist too much. The pads help increase friction between you and the polystyrene impact layer.
For example, this is an advertisement from a helmet maker (I occluded the logo mark of the manufacturer) that talks about how they are working on reducing rotational forces:
As the technology improves (based on the not-inconsiderable amount of money the NFL is putting into helmet technology), we'll see better designs on the market that take into account all sorts of different damage scenarios.