You can cancel a downvote or upvote only a few seconds after your vote by clicking the downvote or upvote sign again. If more then a few seconds have been past, you can't cancel your vote, only if that question/answer was edited.
So, if you can't cancel your vote anymore, this is the only possibility: find a way to edit somehow that question/answer. If your edit will be accepted, after you can retreat your vote.