When oscillated in a fluid, appendages such as insect wings and fish fins can produce large thrust forces while undergoing considerable bending. We attempt to understand the role of flexibility by formulating a simple optimization problem. Can we determine the flexibility which produces maximum thrust, or a given thrust at maximum efficiency? We present first a general model for how flexible surfaces produce vorticity and bend passively in a fluid. The model combines a nonlinear ODE for elastic bodies with a singular integral equation for a potential flow with velocity discontinuities. We solve the linearized model and find a series of local thrust optima with power-law dependences on rigidity and driving frequency. These optima are resonant peaks, damped by fluid inertia, and can be predicted with a scaling analysis. We discuss extensions to large-amplitude motions, and motions of actual fish fins.