The focal length depends on the sport/activity you are shooting and how far away you are from the action.
You need a longer lens when the action is farther away, like a small badminton court vs a giant soccer field.
A 70-200mm lens might be good if you are fairly close to the action, like a basketball game in a gym.
For sports like soccer or football, you may want a lens with more zoom, like 200-400mm.
Indoor activities
A camera that's good at low light helps, which would be one without too much noise in low light/high ISO settings
You can see images samples with high ISO settings on drpreview.com in the image quality sections of the review.
A faster lens(bigger maximum aperture) can help a lot on indoor activities, especially in poorly lit locations like a lot of school gyms. A maximum aperture of f4 or even 2.8 would be good. This allows you to shoot at fast shutter speeds without setting your ISO so high that it ruins your images with noise.
The problem is a lot of fast/long zoom are expensive.
You can rent them at borrowlenses.com to try one out before spending a lot of money.
Outdoor activities
These sports/activities might be taking place in larger area like a soccer field, so a longer zoom can help. Up to 300-500mm would probably be good. They do not need to be as fast(large aperture) though, if you are shooting during the day. If it's at night under lights, you might need a faster lens, depending on the amount of light in the scene.
Camera Settings
General Exposure Settings
You can shoot any mode that works, manual, shutter priority or manual, but many people shoot Aperture Priority
Shoot with a fast shutter speed, most likely 1/500 or faster. 1/1000 or faster would be better.
Do some test shots
You often will need to shoot wide open(maximum aperture), especially indoors under low light conditions.
This would be your maximum aperture , like f2.8 of 4 or f5.6 depending on your lens. However, if it's bright and you can use a smaller aperture, you will get more depth of field.
Exposure Methods
One approach is to shoot aperture priority and set the lens at its maximum aperture, then increase your ISO until the action is not blurred.
Remember, increasing ISO degrades your image, so don't go too high
Again, 1/500 might be the minimum shutter speed, depending on your distance, how fast the action is, etc, but higher is better. 1/1000 would be great.
Some cameras will let you set a minimum shutter speed, so you know you will always freeze the action.
You can also shoot in manual at your biggest aperture and a high enough shutter speed to not blur the action, and then set your ISO to auto. This might work better if the lighting is pretty even. If it is very even lighting, you could set a fixed ISO number.
Shutter priority might also be appropriate, especially outdoors during the day, since you need to have a fast enough shutter speed to freeze the action.
Other Settings
Autofocus modes
You want the camera to continually focus on your subject. Many cameras will try to track your subject if it is moving, sometimes by color.
This can use your battery up more quickly
AI Servo AF for Canon cameras
AF-C - Continuous servo AF
Autofocus Area
There are many different area modes for cameras. You might try Large Zone AF on Canon and for Nikon, AF-C Priority Selection to RELEASE, AF-Area Mode to DYNAMIC AREA AF (9 points) and Focus Tracking with lock-on to 3 (normal)
You get more shots per burst. The camera does not have to write so much data to the memory card. If you fill up the memory buffer on the camera, which is it's internal storage, then the camera might stop shooting until the card catches up. That's why a large buffer on the camera can help with sports too.
Less time to process
Smaller files
You can also shoot RAW files indoors, so you can brighten them up a little if necessary. I have heard of people purposely underexposing by one stop and then brightening the dark images in Lightroom or Camera Raw.
ISO
Use a low ISO setting if possible outside during the day
It will give you less noise in your shots
Indoors, you might be using auto ISO, depending on your exposure mode and the lighting conditions
Many cameras will let you set a maximum ISO while on auto, to avoid very high ISO settings which result in too much noise in your images.
Metering
Some people use spot or center weighted metering to avoid a bright background messing up the exposure, while others use evaluative/average metering.
It also depends on your location, background and lighting conditions
IS(Image stabilization)
You could turn this off if you are using a shutter speed like 1/1000
Processing
You can bring up the shadows to make up for uneven light.