The width of the lighter grey area, and of the green RAM preview line, is one frame. Note that the space between 0 and 5 frames is exactly 5 times the width of the light grey area.
At the end of the timeline, the area in light grey is the duration of the final frame.
But how do I get the indicator to the end? What If I want a keyframe on the 2 second mark?
The last frame is the last frame. Think of the indicator as an L. The | is the start of the frame, the _ is the end of the frame. In this case the last frame starts one frame duration before 2 seconds and ends at 2 seconds. The total length of your comp is 2 seconds.
If you want to put a keyframe past the end of the composition, like you would do if you were to create a seamless loop, then just use the page down key to go to the last frame + 1 and put the keyframe there. If you want the keyframe to be on the last frame of the comp then just go to the last frame.
There's no problem with AE, there's only a problem with the way you're interpreting the indicators.
Just to reinforce what the others are saying:
The current-time indicator sits at the beginning of the frame. Your screenshots show that you are on the last frame.