how much bearing surface is required to support a beam
The answer for bearing length is a little more complicated than most people would assume it would be. I'm going to assume it is supporting uniform loads and no point loads. 

1.5" of bearing length is all you need for this douglas-fir beam, but that's not the limiting factor here. Beam bearing lengths don't take into account the supporting member's ability to carry the loads. So as long as your wall is less than 10' tall, give the beam 3" of bearing with a 2 ply 2x4 built-up column under it. Nail the two plies together following NDS standards. If your supporting member was a steel beam, then that's when 1.5" bearing length would be enough.

It seems counter intuitive, but with dimensional lumber the longer the span the less bearing length you typically need because the end reactions are lower.

For example, your 16' long 4x12 can support a max uniform load of 150 PLF which means you have 1200 lbs at each end. If the same beam was only 5' long, it could support a max uniform load of 1900 PLF which means you have 4750 lbs at each end.

I don't know the answer to your end gap question. I have a feeling that 1/4" is fine on either end, but I don't know for sure.