Special values of $L$-functions for orthogonal groups