Schrödinger equations with singular potentials: linear and nonlinear boundary value problems