Mechanics can be recruited the same way all other crew roles (except Outlaw) can by completing procedurally-generated NPC quests, which will give the quest giver a chance to turn into a recruit-able crew member with a 1/6 base chance to choose the Mechanic class. However, there are a few ways to increase the chance for an NPC to become a mechanic:
If a friendly NPC or a Tenant is either a guard (of any type), Prison Convict, or an Apex Rebel, they have a slightly higher chance to become a Mechanic (25%) compared to other NPCs (16.7%).
If a Tenant is an Electrictian, they have a significantly higher chance to become a Mechanic (50%) compared to other NPCs (16.7%).
Mechanics improve the efficiency of your ship's FTL drive by reducing the amount of fuel required to travel with diminishing returns. The initial mechanic reduces required fuel by 10%, the next by 5% (15% total cost reduction), then 2.5% (17.5% total), etc. Further mechanics will continue to reduce cost as close to a total reduction of 20%, but this value cannot be reached.
Mechanics will engage in combat when chosen as a travel companion. In combat, they will attempt to hit enemies with an NPC Wrench, a two-handed weapon which behaves somewhat like a Soulseeker, having a Tier 1 base DPS of 11 and a fire time of 0.83 seconds (this results in 9.13 base damage for a single hit at tier 1). Mechanics do not possess ranged weaponry, so they cannot hurt enemies which cannot be reached.
Prior to Version 1.3.0, mechanics improved the ship's fuel capacity by 100 units periodically when left on the ship. Left alone mechanics would endlessly buff fuel capacity by 100. Eventually, ships could hold a tremendous amount of fuel (players reported to have gotten fuel capacity well over 10,000) though fuel capacity reset whenever your ship is upgraded.