The answer to 'how to fix light fixture' is to first turn off the power to the light fixture at the circuit breaker. Then, carefully remove the light fixture from the electrical box and inspect the wiring connections. Tighten any loose connections and replace any damaged wires. If the fixture needs to be replaced, disconnect the wires and install the new fixture according to the manufacturer's instructions. Be sure to turn the power back on and test the new fixture.
Fixing a light fixture is generally a straightforward DIY task, but it's important to take safety precautions when working with electricity. If you are uncomfortable working with electrical systems, it's best to call a licensed electrician to handle the repair.