No different than writing software to a releasable stage. Prototyping is a very important stage of building hardware, it's how you test, if you get yourself that far, you can get yourself to a production build. It does mean a bunch of reading and research though. I've been doing embedded/electrical/mechanical systems for decades from consumer grade products to large industrial machines which have to last decades. There are often hard-earned lessons along the way, but many end up jumping out at you. Solving some of those problems sometimes require significant rethinks, but a lot of stuff is not that tricky. Main thing is having good tools to investigate problems.