Why is the range a larger set than the domain? When we have a function $f: \mathbb{R} \to \mathbb{R}$, I can intuitively picture that and think that for every $x \in \mathbb{R}$, we can find a $y \in \mathbb{R}$ such that our function $f$ maps $x$ onto $y$.
I'm confused, however, when we have something like: $g: D \to \mathbb{R}$, where $D$ is the domain of our function such that $D \subset \mathbb{R}$. How can our function output every element in $\mathbb{R}$, when our input was specifically less than the whole set of reals?
 A: I don't agree with your statement that the range is a larger set than the domain.
I give some counter-examples to illustrate.
If you take any constant function defined as $f: R \rightarrow R$, $f(x) \equiv k$ (fixed value of $k$), then
Domain$(f) = R$
Range$(f) = \{ k \}$
As another example, take the 'sign' function defined as
$g: R \rightarrow R$, where $g(x) = \mbox{sign}(x)$.
Then
Domain($g$) = $R$
Range($g$) = $\{ -1, 0, 1 \}$
(It is a convention to define sign(0) = 0.)
If you define $h: R \rightarrow R$ as $h(x) = | x |$, the absolute value of $x$, then
Domain($h$) = $R$
Range($h$) = non-negative reals, which is a smaller set than $R$.
A: The underlying idea of your question is the concept of cardinality. We say that two sets $X$ and $Y$ have the same cardinality iff the exists a bijection $f:X\to Y$ between them. Such relation is an equivalence relation, that is to say, it is reflexive, symmetric and transitive. Hence each cardinality is an equivalent class. We can establish a linear order relation among the possible cardinalities.  Finally, we say that that a set $X$ is infinite iff there exists a bijection between $X$ and a proper subset of it.
For example, the set of natural numbers is infinity because $f:\textbf{N}\to P$, where $f(n) = 2n$ is a bijection between $\textbf{N}$ and the set $P := \{n\in\textbf{N} \mid (n = 2k)\wedge(k\in\textbf{N})\}\subset\textbf{N}$.
At the given example, one can consider the function $\tan:(-\pi/2,\pi/2)\to\textbf{R}$ which is bijective (as suggested by @MichaelMorrow). Therefore, even though the interval $(-\pi/2,\pi/2)$ is a proper subset of $\textbf{R}$, they have the same cardinality, hence the set of real numbers $\textbf{R}$ is infinity.
One interesting result is that $\operatorname{card}(\textbf{N}) < \operatorname{card}(\textbf{R})$, but it is not known if there is a cardinality between both. Cantor has conjectured it and such statement is known as the continuum hypothesis.
A: Perhaps I'm understanding your question differently than some of the other commenters, but I'll point out that saying you have a function $g: D \to \mathbb{R}$ does NOT mean every element of $\mathbb{R}$ gets outputted. Here, the set that comes after the arrow is something called a codomain which can be larger than the range. If every element of your codomain gets outputted, then your function has a specific property called surjectivity, but not every function will have this. For example, consider the function $f: \mathbb{R} \to \mathbb{R}$ given by $f(x) = x^2$. Here, $\mathbb{R}$ is NOT the range of our function since there is no real number that maps to the number $-1 \in \mathbb{R}$ under $f$.
A: If $A$ is a finite set, then it is not possible for there to be a function $f:A\to B$ such that the range is a proper superset of the domain. However, this statement is not true for infinite sets, which is just one reason why they are so counter-intuitive. For instance, we can construct a surjective function $f:\mathbb Z^+\to\mathbb Z$ by mapping the odd positive integers to the nonnegative integers, and mapping the even positive integers to the negative integers. Similarly, the function $f:(-\pi/2,\pi/2)\to\mathbb R$ given by $f(x)=\tan x$ is surjective, even though $(-\pi/2,\pi/2)$ is clearly a proper subset of $\mathbb R$.
