The Public Test Realm (or PTR for short) is a temporary realm that is activated before a sizable patch is introduced to the live servers. This test realm will include the code and changes that will be introduced in that patch.
The PTR is in place so that Blizzard can get feedback and data on upcoming changes. It is integral to the development cycle of any piece of software to have it tested by as wide an audience as possible. The PTR offers a chance for Blizzard to test these changes across a multitude of platforms and playing styles. It also allows them to tweak said changes based on player data to accomplish the goals they have for the patch in question.
Participating in the PTR is relatively simple, although it will require a full download of the PTR client and associated patches (this could be time consuming on setups where the Blizzard Downloader runs slowly).
The first step to participating is to install the PTR client. This is acquired through the Public Test Realm pages of the WoW Official Site (you will be required to log in to access the PTR section!). Simply download the client and install it to a different folder than your WoW installation. (Full details on installing can be found on the PTR site itself). The PTR client will take some time as it will be copying the majority of the WoW game files from the game itself.
The next step is to copy a character from your live server to the test realm. Like the download, this will be done through the PTR section of the WoW site. The number of characters available to copy will change every time the PTR is opened up. Likewise, occasionally "Premade" characters are also available to copy over. This doesn't happen often though and it is typically recommended to copy an existing character over.
These copied characters will retain all items in the inventory and bank. Everything else will be wiped (guild, mailbox, AH, and sometimes Achievements). It is recommended to come to the PTR with all consumables that you may need. These copied characters will also have no effect on the live characters. Everything gained or lost on the PTR will remain solely on the PTR.
Depending on changes to the Addon environment on the PTR, many addons may not function (especially early on in the testing cycle). However, they can still be installed the same way as on live, only navigating to the PTR folder rather than the WoW folder.