Model theory of finite and pseudofinite rings