The most widely-accepted reason that fire engines are painted red dates back to the 1800s -- a time when there was a LOT of competition between the fire brigades of neighboring cities and towns. The firefighters of each brigade took great pride in their pump. Each brigade wanted their rig stand out by being the cleanest, having the most brass, or being a regal color. Because red was the most expensive color, that's what color most crews chose to paint the pump.
Other sources cite the tradition of painting fire engines red going back to the early 1920's. Henry Ford wanted to make cars as inexpensively as possible and only offered cars in one color: black. With all of these black vehicles on the road, the fire service began painting their vehicles red in an effort to stand out.
Today, just as you have many more choices of colors available to you for your vehicle, so do the fire engine manufacturers, and it is not uncommon to see white, yellow, blue, orange, green, or even black fire engines, in addition to red. And while some studies hint that colors such as lime-green may be more visible to the public than traditional red, the vast majority of fire departments continue to use red fire engines -- a color instantly recognized by everyone as that of a fire engine.
Normal Fire Department apparatus and ambulances are painted with a black top over red body. This is a traditional nod to the first closed-cab chief's cars in Chicago. Back then, they had black canvas tops which would not take paint. Someone in administration liked the appearance, so as new closed-cab apparatus came into service, they painted the cab roofs black, and the tradition continues today.
You may also notice the green light on some fire engines. This is also a traditional Chicago-style fire engine feature. Commissioner Albert Goodrich of the Chicago Fire Department (1927 - 1931) had a nautical background. He applied the marine scheme (red light on port, green light on starboard) to fire apparatus, and the idea became a tradition of the Chicago Fire Department. It is also used to mark the bay doors at most Chicago fire stations.