It does not have to form a straight line. Most of the time, it will not. C goes to the center because it is the least electronegative.
In principle, since electrons repel each other, atoms tend to align with the configuration that keeps the farthest apart. So in the case of three atoms, that would be a straight line. More complex molecules will have 3d structure.