You would have to open the side cover to see the mechanism. It's pretty self explanatory once you see it, the shifter lever moves a fork that hits pins on the shift drum end. That ritates the drum, there's a spring loaded roller that engages notches in the drum to hold it at the right rotation for each gear.
There may be some problem with the outer fork or the 5th pin may have even fallen out of the drum.
If the fork is hitting the 5th gear pin but the drum won't turn then there's something stuck in the transmission, a gear frozen on a shaft maybe. If the drum turns but you get no 5th, the shifter forks inside that move the gears may be bent or the drum itself is worn out. But with those drum I would expect a false neutral rather than staying in 4th.