Triangle $PAB$ is formed by three tangents to circle $O$ and $\angle APB = 40^\circ$.  Find $\angle AOB$.

[asy]
import graph;

unitsize(1.5 cm);

pair A, B, O, P, R, S, T;

R = dir(115);
S = dir(230);
T = dir(270);
P = extension(R, R + rotate(90)*(R), T, T + rotate(90)*(T));
A = extension(S, S + rotate(90)*(S), T, T + rotate(90)*(T));
B = extension(R, R + rotate(90)*(R), S, S + rotate(90)*(S));

draw(Circle((0,0),1));
draw((R + 0.1*(R - P))--P--(T + 0.1*(T - P)));
draw(A--B--O--cycle);

label("$A$", A, dir(270));
label("$B$", B, NW);
label("$O$", O, NE);
label("$P$", P, SW);
label("$R$", R, NW);
//label("$S$", S, NE);
label("$T$", T, dir(270));
[/asy]
First, from triangle $ABO$, $\angle AOB = 180^\circ - \angle BAO - \angle ABO$.  Note that $AO$ bisects $\angle BAT$ (to see this, draw radii from $O$ to $AB$ and $AT,$ creating two congruent right triangles), so $\angle BAO = \angle BAT/2$.  Similarly, $\angle ABO = \angle ABR/2$.

Also, $\angle BAT = 180^\circ - \angle BAP$, and $\angle ABR = 180^\circ - \angle ABP$.  Hence, \begin{align*}
\angle AOB &= 180^\circ - \angle BAO - \angle ABO \\
&= 180^\circ - \frac{\angle BAT}{2} - \frac{\angle ABR}{2} \\
&= 180^\circ - \frac{180^\circ - \angle BAP}{2} - \frac{180^\circ - \angle ABP}{2} \\
&= \frac{\angle BAP + \angle ABP}{2}.
\end{align*}

Finally, from triangle $ABP$, $\angle BAP + \angle ABP = 180^\circ - \angle APB = 180^\circ - 40^\circ = 140^\circ$, so \[\angle AOB = \frac{\angle BAP + \angle ABP}{2} = \frac{140^\circ}{2} = \boxed{70^\circ}.\]