Accurate fire localization is essential for effective firefighting and rescue operations. Our study aims to optimize sensor layout using LSTM models for real-time fire localization. Simulation databases have been created considering varying indoor fire scenarios. Data experiments have been designed to compare prediction model accuracies to derive the optimal sensor number and layout. The results showed that the number of sensors had significant impact on the accuracy of fire localization, while the impact of sensor neighboring distance is less significant given fixed sensor numbers. In addition, due to the dynamic burning nature in the proximity of the fire, the prediction of fire locations will become more challenging given more severe fire. Our study provides a generalizable methodology to optimize sensor placement based on simulation and data-driven technologies. The proposed solution is adaptable to different building scenarios, providing valuable decision supports for smart building system designs and smart firefighting.