Consider the open interval $I = (0,1)$ in $\mathbb{R}$, and fix $p \in[1,\infty)$. For a function $u \in C^1(\bar{I})$ we have the standard $W^{1,p}$-norm: $$ \left\Vert u \right\Vert_{W^{1,p}} := \left( \left\Vert u \right\Vert_{L^p(I)}^p + \left\Vert u^\prime \right\Vert_{L^p(I)}^{p} \right)^{1/p}, $$ which is finite since $u$ is of class $C^1$ on the compact interval $[0,1]$. For all $u \in C^1_c(I)$, I know that there holds \begin{equation}\label{eq:1}\tag{1} \left\Vert u\right\Vert_{L^\infty(I)} \leq 2^{1/q} \left\Vert u \right\Vert_{W^{1,p}(I)}. \end{equation} Here, $q$ is such that $$ 1 = \frac{1}{p} + \frac{1}{q}. $$ (In fact, if $u \in C_c^1(I)$ I know that \eqref{eq:1} holds without the factor of $2^{1/q}$; this follows easily from the fundamental theorem of calculus and Hölder's inequality).
I also know that elements of $W^{1,p}(I)$ can be approximated (relative to the $W^{1,p}$-norm) by elements of $C_1(\bar{I})$. By this fact, I am told that the inequality \eqref{eq:1} holds for $all$ functions $u \in W^{1,p}(I)$. My questions are the following:
Based on approximations by functions in $C^1(\bar{I})$, how can one conclude that \eqref{eq:1} holds for all $u \in W^{1,p}(I)$? I see how \eqref{eq:1} is valid for functions in $C_c^1(I)$, but it is not obvious to me that \eqref{eq:1} holds for functions in $C^1(\bar{I})$.
What is the importance of the $2^{1/q}$ factor? I am fairly certain that the $2^{1/q}$ helps answer my first question (i.e. it is what makes \eqref{eq:1} valid for functions in $C^1(\bar{I})$) but I am currently at a loss.
First note that Jensen's inequality gives you $$\int_0^1 |f(t)| \, dt \le \|f\|_p$$ whenever $f \in L^p(I)$.
If $u \in C^1(\overline I)$ you have the fundamental theorem of calculus: if $x,y \in \overline I$ then $$ u(x) - u(y) = \int_x^y u'(t) \, dt$$ so that $$|u(x) - u(y)| \le \int_x^y |u'(t)| \, dt \le \int_0^1 |u'(t)| \, dt \le \|u'\|_p.$$ The triangle inequality gives you $$|u(x)| \le |u(x) - u(y)| + |u(y)| \le \|u'\|_p + |u(y)|.$$ Now integrate with respect to $y$ from $0$ to $1$ to find $$|u(x)| \le \|u'\|_p + \int_0^1 |u(y)| \, dy \le \|u\|_p + \|u'\|_p$$ for all $x \in \overline I$. Thus $$\|u\|_{L^\infty(\overline I)} \le \|u\|_p + \|u'\|_p.$$
The constant in the inequality (1) is just an issue of the norm being used. For any real numbers $a,b \ge 0$ you have $a+b \le 2^{1/p'}(a^p + b^p)^{1/p}$, and in particular $$\|u\|_{L^\infty(\overline I)} \le \|u\|_p + \|u'\|_p \le 2^{1/p'} \left( \|u\|_p^p + \|u'\|_p^p \right)^{1/p}.$$