In the last scenes of Joker, Arthur a.k.a. "The Joker" is being taken to jail in a police car, after he killed a host on live TV. Then some people wearing clown masks crash the police car and free the Joker, praising him as their hero. At that point there's a cut and Joker is in some kind of psychiatric hospital / prison talking to a doctor, and the movie ends.
How did he get there?
It seems unlikely that the clowns who are destroying Gotham and who to free Joker considering him their hero, then just left him to be captured again by the police.