How you remove the socket from the ratchet will depend on the ratchet you have. With some less expensive ratchets, you simply pull the socket off from the ratchet drive square.
This may require a little force to overcome the spring-loaded ball bearing in the ratchet drive square.
Other ratchets have a button on the back of the ratchet head. When this is pressed, it releases the spring from the ball bearing inside the ratchet drive square, which will then allow the socket to fall off the ratchet drive square.
Once you have completed this step you now know how to use a socket with a ratchet wrench.