Are all PPAs safe?
No. Although there are no known PPA which were solely created to spread malicious software, poorly packaged apps in a PPA can cause dependency issues.
From where do I know which PPA refers to which packages?
Click on package details of a PPA, and you will be redirected to a page containing the list of all packages, like this.
Can adding a PPA cause any harm? Or is it that the package when downloaded will cause harm?
The packages in a PPA might cause harm, not adding the PPA itself. Suppose, a PPA contains a updated version of GNOME desktop, which actually has no contents (i.e., a fake, empty package). If you add that PPA, Ubuntu will "upgrade" to that version, and as a result you will lose your graphical user interface. While such PPAs are very uncommon, there are certain PPAs which contain poorly packaged apps, which may cause dependency issues.
In particular is it safe to add ppa:ubuntu-toolchain-r/test?
It depends. However, since this is mentioned in the Ubuntu Wiki, a lot of users would use it (and any malicious packages will be reported quickly), so I would trust this PPA (but this is my opinion. You should determine on your own whether you want to add the PPA).
Or is it more safer to install packages from official websites?
It is always safer to install packages from the official sources, with sudo apt install name-of-software-here
.