An Introduction to Bilevel Optimization: Foundations and applications in signal processing and machine learning