Wireless sensor networks (WSN) are an essential component of modern systems that enable ubiquitous sensing and data collection in a wide range of contexts, including healthcare, smart cities, and environmental monitoring. This article thoroughly covers the three pillars of WSNs i.e. localization, routing, and security along with the integration of WSN with IoT. Localization methods impact the accuracy of data and applications, which in turn influence the determination of the geographical coordinates of sensor nodes. Localization methods, such as range-based and range-free systems, influence data accuracy and energy conservation. This article will also discuss about Routing protocols, which primarily establish energy-efficient and resource-optimal communication paths between nodes in WSNs and popular routing methods like flat, hierarchical, and location-based protocols. It also measures how well they work. In addition to localization and routing, our study delves deep into the most recent security protocols and policies to secure WSNs. Data interception, network interruption, and node penetration are just a few of the many attacks that WSNs are vulnerable to, making security a top priority. Methods like authentication, encryption, and intrusion detection are the main focus points. Similarly, 6TiSCH protocols and their impact in WSN-IoT systems is also discussed. This study highlights the continuous need of improving the security, efficiency, and reliability of WSNs for IoT applications. The detailed survey on three pillars of WSN provides an insight into the existing research gaps which has to be addressed.