Ridley is fought two times.
CERES SPACE STATION: Ridley can be shot at, but cannot be killed. After Samus gets hurt enough to make her low energy alarm sound, Ridley makes his escape and flies away, forcing you to also escape Ceres before it blows up.
LOWER NORFAIR: Ridley is quite possibly the strongest and most difficult boss in the game. When you enter his room, he seems to be gone, but use this time to charge up your Beam. When he appears, immediately release your charged beam, and then charge again, and release. You may be tempted to use Super Missiles or normal Missiles, and while they can be effective, they are not nearly as effective as fully-charged Plasma Beam shots.
Ridley has a much more advanced arsenal than his original Metroid incarnation. Beyond shooting fireballs, he now flies around the room, swooping down at you while trying to pick you up in his clutches. He can also swing his tail around and do a downward bounce-attack with it. When he bounces, kneel and aim directly upward while blasting him with more charged shots.
Keep charging your beam and let them loose as soon as you can. Use the Screw Attack coupled with Space Jump if you want to avoid any of his attacks. Ridley will be toast in no time.