You should use H.264 for the codec. It's probably the most standard codec you'll find in Apple systems and beyond.
About the resolutions, you'll probably don't need to care much about that. As long as you have a decent resolution, your video should scale well on any device. But, if you really want the best resolution for each device you should look at Apple specs for each device.
For instance, the iPhone 3GS supports 480p, while the iPhone 4 supports 720p, and the iPhone 4S goes up to 1080p. Both iPads should support 1080p.