Localizing the eigenvalues of matrix-valued functions: analysis and applications