Analytical results for the entanglement Hamiltonian of a free-fermion chain