In retirement, Maggie Ellis, like tens of thousands of her teaching colleagues — and firefighters, police officers, and other public employees in California and a dozen other states — will face the consequences of two little-understood provisions of Social Security.