I was trying to install a ceiling fan in my apartment and came across these connectors when removing the light. What is this and how do I take it off?
It's a push-in wire connector, like these from Ideal.
The wire should come out without too much difficulty; grip the connector firmly in one hand, then pull the wire with the other.
The instructions for the Ideal connectors that I linked to say:
7. In order to remove a wire, pull and twist the wire back and forth.
Since you're installing a new light fixture, this is also relevant:
6. Connector is reusable on solid wires of the same wire gauge or larger. If reusing connector, cut and re-strip conductor.
You can assume that 50% of the time you may have to replace the connector-- cost $0.24, except that they are available in a pack of 10 or more.
I found a more reliable method to remove and re-use: If you can carefully remove the outer case with a micro screw driver, without damaging the case and loosing a small metal strip, then you are good.