It's calculated separately for each webpage according to a formula, but Google keeps the exact formula secret. Essentially the calculation adds up the values of all the incoming links to the page. The more incoming links there are, and the greater their average value, then the higher the pagerank. But as I said, the exact details of the calculation are a secret.
So to increase the pagerank, you need to get more incoming links for it.
Google was one of the first engines to take 'off-page' factors into account, in the form of anchor text and pagerank. Their original paper on Google is here, [infolab.stanford.edu...]
The original concept is essentially a 'random surfer' loading up a page and clicking on random links repeatedly, each click counting as a 'score' to the webpage linked to, with some dilution added in. The theory is that pages that are more linked to receive higher scores because there's a higher probability the random surfer will click a link to that page.
Anchor text was also important in the early days and still is. Other off page factors are now thought to be part of the wider algorithm and may be tied to or totally independent of pagerank.