What are the clusters behind the pedals on an electric golf cart?

Those are usually micro switches. They sense the location of the pedal when you're pushing it. They can also be brake lights if you have a turn signal & brake light package installed.