The growing use of Unmanned Aerial Vehicles (UAVs) for various applications requires ubiquitous and reliable connectivity for safe control and data exchange between these devices and ground terminals. Depending on the application, UAV-mounted wireless equipment can either be an aerial user equipment (AUE) that co-exists with the terrestrial users, or it can be a part of wireless infrastructure providing a range of services to the ground users. For instance, AUE can be used for real-time search and rescue and/or video streaming (surveillance, broadcasting) and Aerial Base Station (ABS) can enhance coverage, capacity and energy efficiency of wireless networks. In both cases, UAV-based solutions are scalable, mobile, easy and fast to deploy. However, several technical challenges have to be addressed before such solutions will become widely used. In this work, we present a tutorial on wireless communication with UAVs, taking into account a wide range of potential applications. The main goal of this work is to provide a complete overview of the main scenarios (AUE and ABS), channel and performance models, compare them, and discuss open research points. This work is intended to serve as a tutorial for wireless communication with UAVs, which gives a comprehensive overview of the research done until now and depicts a comprehensive picture to foster new ideas and solutions while avoiding duplication of past work. We start by discussing the open challenges of