Proof (set of smooth points is open and dense)
$X$ is affine irreducible
Suppose $X\subseteq \mathbb{A}^n$ be an affine irreducible variety with $I(X) = (f_1, \ldots, f_m)$. By definition, $X^{\text{sm}}$ is non-empty, so it suffices to show it is open. Let $d = \dim X$, and we want to show $$ \begin{align*} X \setminus X^\text{sm} ={}& \sb{P\in X}{\dim T_{X,P} > d} \end{align*} $$ is a closed in $X$.
We noted $$ \begin{align*} \dim T_{X,P} = n - \op{rank} J_P \end{align*} $$ where $J_P = (\pdfd{f_i}{x_j}(P))_{i,j}$ is the Jacobian matrix. Linear algebra#Determinantalrank%E2%80%93sizeoflargestnon-vanishing_minor) says $\op{rank} J_P \leq r$ if all $r\times r$ minors of $J_P$ vanish. This gives $\pmat{n \\ r}\cdot \pmat{n\\ m}$-many polynomial equations, so $X \setminus X^{\text{sm}} = \sb{P\in X}{\op{rank} J_P \leq n - d - 1}$ is a closed subvariety taking $r = n - d -1$.
General $X$
Let $X$ be an affine or projective algebraic set.
Suppose $X = X_1 \cup \ldots\cup X_l$ where $X_1, \ldots, X_l$ are its irreducible components, so $X_i^{\text{sm}}$ is open and dense in $X_i$. Note by definition $$ \begin{align*} X \setminus X^\text{sm} ={}& \bigcap_{i=1}^{l} X \setminus \Bigl(X_i^\text{sm} \setminus \bigcup_{\substack{j=1: \\ j\neq i}}^{l} X_j\Bigr) \\ ={}& \bigcap_{i=1}^{l} \Bigl((X_i \setminus X_i^\text{sm}) \cup \bigcup_{\substack{j=1: \\ j\neq i}}^{l} X_j\Bigr). \end{align*} $$ $X_i \setminus X_i^\text{sm}$ is closed in $X_i$ so in $X$, and hence $X \setminus X^\text{sm}$ is closed in $X$ by finite set operations.
Moreover if $U$ is a non-empty open set of $X$, then $U \cap X_i$ is a non-empty open set in $X_i$ for some $i$, so $U \cap X_i^\text{sm}$ is a non-empty open set and hence dense. Therefore $$ \begin{align*} U \cap X^\text{sm} \supseteq (U \cap X_i^\text{sm}) \setminus \bigcup_{\substack{j=1: \\j\neq i}}^l X_j \neq \emptyset. \end{align*} $$
The openness and density properties pass down to any open subset of $X$, which proves the case for an quasiprojective variety $X$.