High-Probability and Large Deviations Techniques for Design and Analysis of Large-Scale and Distributed Learning Systems