Create a large rectangle shape that covers the whole screen area. Keep this on its own layer above all your other layers.
To fade in from black, set a keyframe for 100% opacity where you want the fade to start. Then, over time, maybe after 3 seconds or so, you set another keyframe for 0% opacity.
To fade into black, set a keyframe for 0% where you want the fade to start. Then, 3 seconds later, set another keyframe for 100% opacity.
If your camera is panning or using the Z channel, set the black rectangle's layer settings to "immune from camera moves" - saves many a headache when you do.
Also a quick additional tip - if you are fading to black (usually at the end of your scene), after you set the fade (entering 0% opacity at the beginning of your fade and 100% at the end), be sure to go back to frame 1 and set the opacity at 0%. Otherwise you'll have your scene slowly fade in from black up until the frame you set the fade out