Polyethyleneimine (PEI) is a widely used cationic polyelectrolyte. In organic electronics, it is a universal surface modifier for shifting the electrode work function (Φ) and improving charge injection into electronic devices. This effect may depend on the conformation and dipolar order of the PEI ultrathin film, but their detailed experimental evaluation has not yet been reported. Thus, we used sum-frequency generation (SFG) spectroscopy to probe the net orientation of polar groups of PEI films on glass and gold. The films were fabricated by spin-coating from alcoholic solutions or by dip-coating from aqueous solutions of various pH values, with both branched (b-PEI) and linear (l-PEI) structures. The obtained SFG spectra and atomic force microscopy (AFM) images indicated that the conformational ordering of the PEI layers increases over the period of 14 days after fabrication, being slightly more pronounced for l-PEI vs b-PEI, and for dip-coating vs spin coating fabrication. Furthermore, both the pH of the dip-coating solutions and the substrate nature influence the final morphology and order of the adsorbed films. On glass, they are optimized at an intermediate pH 5, while on gold, the greatest homogeneity is observed at pH 2 and the largest dipolar order is observed at pH 10. The pH dependence of changes in the work function of gold by PEI (|ΔΦ|) suggests that the electronic contribution is dominant. Nevertheless, the evolution of the PEI dipolar ordering was accompanied by small variations of |ΔΦ|, suggesting that it does have a significant contribution, especially at conditions for which the electronic contribution is reduced.