The answer to 'how to replace light fixture' is to safely disconnect the old light fixture, install the new one, and reconnect the wiring. First, turn off the power to the light at the circuit breaker. Then, remove the old fixture by unscrewing it from the electrical box and disconnecting the wires. Next, attach the new fixture to the electrical box, connect the wires (black to black, white to white, and green or bare copper to the green or bare copper ground wire), and secure the fixture in place. Finally, turn the power back on and test the new light.
It's important to take safety precautions when working with electricity, such as turning off power, using insulated tools, and not touching bare wires. If you're not comfortable doing this yourself, it's best to hire a licensed electrician to ensure the job is done safely and up to code.