PR is an unincorporated territory of the United States classified as a Commonwealth. Its residents are US citizens but cannot vote. They do not pay US federal taxes. You need a valid US visa to enter PR unless you go directly from continental US. Citizens of the countries that are part of the visa waiver program do not need visas as long as they stay for less than 90 days. There is no immigration clearance when you leave PR for US sine you have been cleared when entering PR.
Basically, you need to go to US consulate and apply for a US visa to visit PR.