broken 'speed sensor'?

A few days ago I had my check engine light on and they told me that I needed a new speed sensor in the transmission, which ended up costing 350$ with installation and such… What the hell is that thing and what can I not do to keep it operating? Thanks.

it tells you and the comp how fast your goin fix it and be done wit it

that was an even dumber question than i thought, good to know somethings actually are what they are named