Layer potentials, Green's formulae, Kac's problem, and refined Hardy inequality on homogeneous Carnot groups