It may have a simple wire/cable connection problem, or a sensor problem, both difficult for an amateur to find and isolate!
If you are not an avid DIYer (electrically), then you might want to invest in an e-bike tester, which may help further in discovering where the fault may lie.
I have...