What is the purpose of two cylindrical holders in RJ45 female connector for PCB
These are strain relief fittings. They spread the horizontal force that's exerted when you insert or remove the connector from the socket. This helps prevent the electrically connected pins being damaged over time. To use them, follow the datasheet layout for the part and simply put the corresponding hole in the PCB. Those fittings will clip into those drilled holes and hold the part in place.

As pointed out by @DaveTweed in the comments, there are also the metal pins connected to the shield, which counteract the normal force trying to lift the connector upwards. These pins should be soldered to the board, and probably connected to ground.