To get a motor to reverse there are a host of methods used, it could be a separate field and armature winding, it could be a capacitor, but for garage doors it's common to use 12 or 24 volt motors and battery back-up so you can still open the door should the power fail.
My father-in-law had garage doors professionally fitted, however the only manual control is a button over 6 foot high in garage which can open or close the doors, the main controls are wireless, he had one in car and one in the hallway of house, the door was completely out of sight when closing, OK it would stop if the rubber buffer hit something, and an adult could open it from inside. But be it a cat or a child if they wandered in unseen then they could be trapped for days.
It is not the only dangerous electric item, mother had a stair lift fitted by council, the stair lift super safe, but it had an arm which needed extending before use, again out of sight, so could crush.
So even when done by a professional they can get it wrong, even big specialise firms get it wrong. In cases where it has gone wrong, it's not covered by insurance, in the case of Semelia Campbell think firm fined £50,000 plus any compensation the latter may be covered by insurance.
For me it was a massive problem, I used books to guide me, and employed a safety officer to over see the work, the problem is some times the safety device makes it worse not better, I remember the mad dash to find some thing to stop a part falling when the safety switch cut off the air that held it up. After that we had two air systems one was never cut by the E-stop.
What I am saying it is very easy to make a mistake. But also I do see if you really want to do it, then better to help you do it safely than simply say leave it alone.
So first requirement is a brake, so when you energise the motor the brake is released, second you must be able to reverse it, and third you must be able to manually operate it, to do the latter there needs to be a safe way to release the brake, this is a major problem, the normal method is to use a worm drive, this will normally stop a run away when brake is released, and a handle which can be put on the end of the motor drive shaft.
However the brake is normally spring activated, no power brake is on, so most use battery powered motors and brakes so even with a power cut, there is battery power to release the brake. Even a gate needs something to stop wind moving the gate.
So in the main 4 wires at least, it may be polarity is swapped on two to open and close, and other two work brake, or it can be common, open, close and brake. The latter common with AC motors which normally have a release leaver which will also release brake.
I had one three phase motor with 6 wires, earth and three phases, and a 24 volt supply DC which had a signal on that as well called ASCii which connected to a PLC the motor could have the speed, and direction together with brake all controlled by those two 24 volt wires which also told the PLC where the arm driven by the motor was. One can't simply count the wires and say this is how it must work.
We see today even cars where rear lights have just 2 wires for the lot, real pain to wire a trailer up. Maybe with pictures or old instructions for the motors one may work out how they work, but it will not be easy.