As a general rule there should be pigtail with a plug coming from the motor.  With that unplugged the wheel will come out.  Don't feel bad, my first e-bike flat tire was at about 10 miles from new.  It wasn't much different than a non motorized bicycle to deal with.