The Internet of Things has developed greatly over the last decade to cater for many diverse applications across almost all fields of life. Many of these applications can either profit or even explicitly require deployment underground, such as precision agriculture, but also land, pipeline or mine monitoring. Underground deployment offers many advantages, such as concealment of the devices for their protection. However, the underground environment is also very challenging, especially for wireless communications and energy harvesting. In this survey and tutorial, we offer a comprehensive view of the complete topic, from theoretical foundations of wireless communications underground, through system architectures and applications, to energy harvesting options. These topics cannot be viewed separately from each other, as they are deeply intertwined and all of them need to be considered before a possible deployment. We will show that wireless underground sensor networks have a great potential for a variety of applications and are an intriguing alternative to overground deployments. We will describe the state of the art in a tutorial style, so that beginners can also profit. Last but not least, we will identify remaining challenges to guide researchers in this area.