Probabilistic Analysis and Optimization of Packet Losses in Dense LoRa Networks