How does one define restrictions on $x$ or $\theta$ when simplifying trigonometric identities? When simplifying a trigonometric identity, such as $\frac{\sec^2(x)}{\tan(x)}$, how does one find the domain restrictions for these equations? Is it simply all values for which any trig function is either $0$ or undefined? When working through the problem, I found that $x\neq \tan^{-1}(0)$, $\cos^{-1}(0)$, $\sin^{-1}(0)$, or $\cot^{-1}(0)$, but isn't it theoretically possible to get any trigonometric function in a denominator, thereby adding another restriction?
 A: Yes, it’s possible to add a restriction at any stage if you’re not careful with your working.
As a much simpler example, the function $f(x)=x^2$ obviously has no natural restrictions to its domain. But $g(x)=\frac{x^2(x-5)}{x-5}$, although you could simplify the fraction making it identical to $f(x)$, would have to be restricted at $x=5$. You can see how we could introduce any number of arbitrary restrictions.
When working with $\frac{\mathrm{sec}^2x}{\mathrm{tan}x}$, just try to avoid dividing by anything unnecessary. However, even if you introduce arbitrary restrictions along the way, you can check each of them individually at the end.
A: Note. The quantity
$$\frac{\sec^2x}{\tan x}$$
is a trigonometric expression, not a trigonometric identity.  The equation
$$\frac{\sec^2x}{\tan x} = \cot x + \tan x$$
is a trigonometric identity, meaning that it holds for all values of the variables where both expressions are defined.
Domain of definition of a trigonometric expression
To define the domain of definition of a trigonometric expression, you must make sure that each function in the expression is defined and that you can perform each of the indicated operations.
For the expression
$$\frac{\sec^2x}{\tan x}$$
we require that $\sec x$ and $\tan x$ are defined and that $\tan x \neq 0$ since $\tan x$ is in the denominator.
Since 
$$\sec x = \frac{1}{\cos x}$$
$\sec x$ is only defined when $\cos x \neq 0$, so we require that 
$$x \neq \frac{\pi}{2} + n\pi, n \in \mathbb{Z}$$
Since 
$$\tan x = \frac{\sin x}{\cos x}$$
$\tan x$ is only defined when $\cos x \neq 0$, which leads to the same restriction as above.
Since $\tan x = 0 \implies x = n\pi, n \in \mathbb{Z}$, we have the additional restriction that $x \neq n\pi, n \in \mathbb{Z}$.
Hence, the domain of definition is 
$$\left\{x \in \mathbb{R} \mid x \neq \frac{\pi}{2} + n\pi, n \in \mathbb{Z}\right\} \cap \left\{x \in \mathbb{R} \mid x \neq n\pi, n \in \mathbb{Z}\right\} = \{x \in \mathbb{R} \mid x \neq \frac{n\pi}{2}, n \in \mathbb{Z}\}$$  
Domain of definition of a trigonometric identity
To find the domain of definition of a trigonometric identity, we must find the intersection of the domains of each trigonometric expression in the equation are defined.
Example.  $\dfrac{\sec^2x}{\tan x} = \cot x + \tan x$.
$$\frac{\sec^2x}{\tan x} = \frac{1 + \tan^2x}{\tan x} = \frac{1}{\tan x} + \tan x = \cot x + \tan x$$
We showed above that the LHS has domain of definition
$$\left\{x \in \mathbb{R} \mid x \neq \frac{n\pi}{2}, n \in \mathbb{Z}\right\}$$
Notice that the expression $\cot x + \tan x$ is only defined when $\cot x$ and $\tan x$ are both defined.
Since 
$$\cot x = \frac{\cos x}{\sin x}$$
$\cot x$ is only defined when $\sin x \neq 0 \implies x \neq n\pi, n \in \mathbb{Z}$.  
We saw above that $\tan x \neq 0 \implies x \neq \dfrac{\pi}{2} + n\pi, n \in \mathbb{Z}$.
Thus, the expression $\cot x + \tan x$ also has domain of definition 
$$\left\{x \in \mathbb{R} \mid x \neq \frac{n\pi}{2}, n \in \mathbb{Z}\right\}$$
Therefore, the domain of definition for the identity is 
$$\left\{x \in \mathbb{R} \mid x \neq \frac{n\pi}{2}, n \in \mathbb{Z}\right\}$$
Example. $\dfrac{\sin x}{1 - \cos x} = \dfrac{1 + \cos x}{\sin x}$.
$$\frac{\sin x}{1 - \cos x} = \frac{\sin x}{1 - \cos x} \cdot \frac{1 + \cos x}{1 + \cos x} = \frac{\sin x(1 + \cos x)}{1 - \cos^2x} = \frac{\sin x(1 + \cos x)}{\sin^2x} = \frac{1 + \cos x}{\sin x}$$
The expression on the left-hand side is defined for all real numbers except 
$x = 2n\pi, n \in \mathbb{Z}$.  The expression on the right-hand side is defined for all real numbers except $x = n\pi, n \in \mathbb{Z}$.  Since both sides of the identity must be defined, the domain of definition of the identity is the intersection of these two domains of definition, which is 
$$\{x \in \mathbb{R} \mid x \neq 2n\pi, n \in \mathbb{Z}\} \cap \{x \in \mathbb{R} \mid x \neq n\pi, n \in \mathbb{Z}\} = \{x \in \mathbb{R} \mid x \neq n\pi, n \in \mathbb{Z}\}$$
