Cut around the base of the brackets if they were caulked or painted after being secured with their screws. This extra step will ensure that the wall doesn't get damaged when the brackets are removed. Use a utility knife the cut the caulk or paint, taking care not to cut into the drywall or other surface to which the brackets are attached.
Remove the screws that secure the rail to the bracket starting at the top of the rail. It is usually easier to remove the rail first and then remove the brackets from the wall. Unfasten the screws using the proper type of screwdriver depending on the type of screws used. Have someone hold the rail as you remove the screws to ensure it doesn't fall.
Unscrew each bracket and remove it from the wall.