In simply typed lambda calculus, a function is a mathematical construct that takes an input and produces an output based on a specific rule or mapping. Functions can be defined using lambda notation, where a variable is bound to an expression, and they play a crucial role in establishing how data is processed and manipulated within this formal system. Functions enable abstraction and allow for the creation of complex expressions by combining simpler ones.