Finding exact $p$ value for the binomial test for a single proportion, using the table with probabilities under the binomial distribution
Assuming a table for a certain number of trials $n$, with a column per true probability $P$, and a row for each possible number of successes $X$
Two sided 
$p$ value is the probability of finding the observed number of successes or a more extreme number, given that the null hypothesis is true.Except for the case where $\pi_0$ (the population proportion of successes according to the null hypothesis) is $0.5$, the sampling distribution of the observed number of successes $X$ is not symmetric under the null hypothesis. Finding the two sided $p$ value for nonsymmetric distributions is a bit complicated, and you probably don't need to be able to do this by hand. 
Right sided 
$p$ value is the probability of finding the observed number of successes or a larger number, given that the null hypothesis is true.

Left sided 
$p$ value is the probability of finding the observed number of successes or a smaller number, given that the null hypothesis is true.
