Finding exact $p$ value for the sign test, 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 positive differences or a more extreme number, given that the null hypothesis is true.
Find the table for the appropriate number of trials $n$. This is the number of positive differences plus the number of negative differences (so the total number of difference scores in your sample minus the number of difference scores that are equal to 0)
Find the column with true probability $P$ equal to 0.5 (the value according to the null hypothesis)
Use the smaller of the number of positive differences and the number of negative differences in your data as your observed number of 'successes' $X$. Then use the table to find the probability that the number of successes is 0, the probability that the number of successes is 1, etc, up to and including your observed number of 'successes' $X$
Sum all these probabilities, and multiply the result by 2. This is your two sided $p$ value
Example: suppose that the number of positive differences in the sample is equal to $2$, and the number of negative differences in the sample is equal to $8$. The total number of trials $n = 2 + 8 = 10$ (differences equal to 0 are excluded from the analysis). Then the two sided $p$ value is equal to $(0.001 + 0.010 + 0.044) \times 2 = 0.11$.
Right sided
$p$ value is the probability of finding the observed number of positive differences or a larger number, given that the null hypothesis is true.
Find the table for the appropriate number of trials $n$. This is the number of positive differences plus the number of negative differences (so the total number of difference scores in your sample minus the number of difference scores that are equal to 0)
Find the column with true probability $P$ equal to 0.5 (the value according to the null hypothesis)
Use the number of positive differences in your data as your observed number of 'successes' $X$. Then use the table to find the probability that the number of successes is equal to your observed number of 'successes' $X$, the probability that the number of successes is one more than your observed number of successes, the probability that the number of successes is two more than your observed number of successes, etc, up to and including an observed number of successes equal to the total number of trials $n$
Sum all these probabilities. This is your right sided $p$ value
Example: suppose that the number of positive differences in the sample is equal to $8$, and the number of negative differences in the sample is equal to $2$. The total number of trials $n = 8 + 2 = 10$ (differences equal to 0 are excluded from the analysis). Then the right sided $p$ value is equal to $0.044 + 0.010 + 0.001 = 0.055$.
Left sided
$p$ value is the probability of finding the observed number of positive differences or a smaller number, given that the null hypothesis is true.
Find the table for the appropriate number of trials $n$. This is the number of positive differences plus the number of negative differences (so the total number of difference scores in your sample minus the number of difference scores that are equal to 0)
Find the column with true probability $P$ equal to 0.5 (the value according to the null hypothesis)
Use the number of positive differences in your data as your observed number of 'successes' $X$. Then use the table to find the probability that the number of successes is 0, the probability that the number of successes is 1, etc, up to and including your observed number of 'successes' $X$
Sum all these probabilities. This is your left sided $p$ value
Example: suppose that the number of positive differences in the sample is equal to $2$, and the number of negative differences in the sample is equal to $8$. The total number of trials $n = 2 + 8 = 10$ (differences equal to 0 are excluded from the analysis). Then the left sided $p$ value is equal to $0.001 + 0.010 + 0.044 = 0.055$.