[proofplan]
We choose a basis of $U$, extend it to a basis of $V$, and then pass to the corresponding dual basis of $V^*$. The dual basis elements attached to the added basis vectors vanish on $U$, while the dual basis elements attached to the basis vectors of $U$ do not. This identifies $U^0$ exactly as the span of those latter dual basis elements, so its dimension is the number of basis vectors needed to extend a basis of $U$ to a basis of $V$.
[/proofplan]
[step:Extend a basis of $U$ to a basis of $V$]
Let $m := \dim_k U$ and $n := \dim_k V$. Choose a basis $(u_1,\dots,u_m)$ of $U$. Since $U$ is a subspace of the finite-dimensional vector space $V$, the basis extension theorem gives vectors $v_{m+1},\dots,v_n \in V$ such that
\begin{align*}
\mathcal{B}:=(u_1,\dots,u_m,v_{m+1},\dots,v_n)
\end{align*}
is a basis of $V$. For uniform notation, define $b_i := u_i$ for $1 \leq i \leq m$ and $b_i := v_i$ for $m+1 \leq i \leq n$, so that $\mathcal{B}=(b_1,\dots,b_n)$.
[/step]
[step:Construct the dual basis and record how it acts on $U$]
Let $(f_1,\dots,f_n)$ be the dual basis of $V^*$ associated to $\mathcal{B}$. Thus, for each $i \in \{1,\dots,n\}$, the map $f_i: V \to k$ is the unique $k$-linear functional satisfying
\begin{align*}
f_i(b_j)=\delta_{ij}
\end{align*}
for every $j \in \{1,\dots,n\}$, where $\delta_{ij}$ denotes the Kronecker delta.
If $i>m$, then $f_i(u_j)=f_i(b_j)=0$ for every $j \in \{1,\dots,m\}$. Since $(u_1,\dots,u_m)$ is a basis of $U$ and $f_i$ is $k$-linear, it follows that $f_i(u)=0$ for every $u \in U$. Hence
\begin{align*}
f_i \in U^0
\end{align*}
for every $i \in \{m+1,\dots,n\}$.
[/step]
[step:Identify $U^0$ as the span of the dual basis elements beyond $U$]
We prove that
\begin{align*}
U^0=\operatorname{span}_k\{f_{m+1},\dots,f_n\}.
\end{align*}
The inclusion
\begin{align*}
\operatorname{span}_k\{f_{m+1},\dots,f_n\}\subset U^0
\end{align*}
follows from the previous step and from the fact that $U^0$ is closed under $k$-linear combinations.
Conversely, let $\varphi \in U^0$. Since $(f_1,\dots,f_n)$ is a basis of $V^*$, there exist unique scalars $a_1,\dots,a_n \in k$ such that
\begin{align*}
\varphi=\sum_{i=1}^n a_i f_i.
\end{align*}
For each $j \in \{1,\dots,m\}$, the vector $u_j=b_j$ belongs to $U$, so $\varphi(u_j)=0$. Evaluating the above expansion at $u_j$ gives
\begin{align*}
0=\varphi(u_j)=\sum_{i=1}^n a_i f_i(b_j)=a_j.
\end{align*}
Thus $a_1=\cdots=a_m=0$, and therefore
\begin{align*}
\varphi=\sum_{i=m+1}^n a_i f_i \in \operatorname{span}_k\{f_{m+1},\dots,f_n\}.
\end{align*}
This proves the reverse inclusion.
[guided]
The key point is that the dual basis detects the coordinates of a vector with respect to the chosen basis $\mathcal{B}$. We first show that every functional built from $f_{m+1},\dots,f_n$ vanishes on $U$. Indeed, if $i>m$, then $f_i(u_j)=f_i(b_j)=0$ for every basis vector $u_j$ of $U$, because $i \neq j$. If $u \in U$, then there are scalars $c_1,\dots,c_m \in k$ such that
\begin{align*}
u=\sum_{j=1}^m c_j u_j.
\end{align*}
By $k$-linearity,
\begin{align*}
f_i(u)=\sum_{j=1}^m c_j f_i(u_j)=0.
\end{align*}
Hence each $f_i$ with $i>m$ lies in $U^0$, and every $k$-linear combination of them also lies in $U^0$.
Now let $\varphi \in U^0$. Since $(f_1,\dots,f_n)$ is a basis of $V^*$, there are unique scalars $a_1,\dots,a_n \in k$ with
\begin{align*}
\varphi=\sum_{i=1}^n a_i f_i.
\end{align*}
Because $\varphi$ belongs to $U^0$, it must vanish on every vector of $U$, in particular on each basis vector $u_j$ with $1 \leq j \leq m$. Evaluating at $u_j=b_j$ gives
\begin{align*}
0=\varphi(u_j)=\sum_{i=1}^n a_i f_i(b_j)=a_j.
\end{align*}
Thus the coefficients of $f_1,\dots,f_m$ must all be zero. The only possible nonzero coefficients are those of $f_{m+1},\dots,f_n$, so
\begin{align*}
\varphi=\sum_{i=m+1}^n a_i f_i.
\end{align*}
Therefore $\varphi \in \operatorname{span}_k\{f_{m+1},\dots,f_n\}$. Combining both inclusions gives
\begin{align*}
U^0=\operatorname{span}_k\{f_{m+1},\dots,f_n\}.
\end{align*}
[/guided]
[/step]
[step:Count the basis elements in the identified annihilator]
Since $(f_1,\dots,f_n)$ is a basis of $V^*$, the subfamily $(f_{m+1},\dots,f_n)$ is linearly independent. From the previous step, this subfamily spans $U^0$, so it is a basis of $U^0$. Hence
\begin{align*}
\dim_k U^0=n-m.
\end{align*}
Therefore
\begin{align*}
\dim_k U+\dim_k U^0=m+(n-m)=n=\dim_k V.
\end{align*}
This is the desired dimension formula.
[/step]