Place it after the moment of failure, once the viewer has seen what went wrong, so the reaction lands as the punchline. Follow it with the sad violin for a drawn-out comic finish, or let the wrong answer sting close the joke instead.