Where is the thalamus?
The thalamus is a large, symmetrical (meaning there is one in each cerebral hemisphere) structure that makes up most of the mass of the diencephalon. A large number of pathways travel through the thalamus, including all of the sensory pathways other than those devoted to olfaction (smell).
What is the thalamus and what does it do?
The thalamus is often described as a relay station. This is because almost all sensory information (with the exception of smell) that proceeds to the cortex first stops in the thalamus before being sent on to its destination. The thalamus is subdivided into a number of nuclei that possess functional specializations for dealing with particular types of information. Sensory information thus travels to the thalamus and is routed to a nucleus tailored to dealing with that type of sensory data. Then, the information is sent from that nucleus to the appropriate area in the cortex where it is further processed.
For example, visual information from your retina travels to the lateral geniculate nucleus of the thalamus, which is specialized to handle visual information, before being sent on to the primary visual cortex (the main area for visual processing in the brain). A similar pathway through the thalamus can be delineated for all sensory information except smell. In fact, the majority of all of the signals (not just sensory) that pass to the cortex first pass through the thalamus.
Thus, the thalamus has a major role as a gatekeeper for information on its way to the cortex, making sure that the information gets sent to the right place. However, to consider the thalamus as just a gatekeeper or relay station is selling this structure a bit short. A significant portion of the incoming fibers to the thalamus come not from sensory systems, but from the cortex itself. There are many connections to the thalamus that are involved in taking information from the cortex, modulating it, and then sending it back to the cortex. This means that the thalamus is an important part of cortical processing in general, and more than just a brief stop for signals on their way to the cortex.
With this in mind, it shouldn't be that surprising that the thalamus is involved in complex brain processes like sleep and wakefulness. It even is thought to play a crucial role in maintaining consciousness. So, far from just a relay station, the thalamus is an integral area involved in higher-order brain processing of various types.