Nagato is the controller of the pain corpses. Nagato can use wind, the Rinnegan gives him control to send chakra signals out to control the dead ninja and their elemental affinites. The reason why Nagato can use all elements is cause he has dead corpses who can use them.
Nagato himself is a wind user who conducts his chakra through the wind and using the wind to disguise where his position is.
The God realm pain, who can use Shinra tensei is a lightning element user.
This will clear things up:
You must be registered for see links
Pain is tough to use because you are limited to 3 moves per turn, so choosing which to use and what to do is difficult...