Reason behind formation of different shapes of cell
Cell shape is dictated by the cytoskeletal arrangement. There are both intrinsic and extrinsic factors that control cell shape. 

Extrinsic factors consist of environmental factors such as extracellular matrix. Rho-GTPases relay the environmental signal to the cells to cause cytoskeletal rearrangement. 

Intrinsic factors are basically the stable transcriptomic identity (a gene regulatory programme) which determine a cell shape. I personally don't have an idea about what genes give an intrinsic cell shape. For e.g. why does hela cell look different from HEK cell in the same type of cell culture plate under same conditions (even at low densities where there is no neighbor effect).