Stability and critical phenomena of black holes and black rings