The adverb perchance is an archaic synonym of perhaps. It tends to sound out of place in modern English, though it does appear where a writer wishes to affect a conspicuously old-fashioned tone. Elsewhere, perchance can always give way to perhaps.
Perchance does not traditionally mean by any chance, though modern writers sometimes use it this way.
These writers use perchance to create an archaic, humorous, or ironic tone:
Would he perchance know who currently possessed the fauteuil d’amour of King Edward VII? [Slate]
If you are not, perchance, a regular reader of the poetically titled magazine Obesity, you may have missed what has to be one of the most visually memorable scientific stories. [Guardian]
It gives us license to bring up Austen/Dickens/Keats when we’re out with friends, and perchance not get smacked for doing so. [North Shore News]
There are exceptions. For example, these writers seem to use perchance earnestly:
If, perchance, you were wondering whether the spirit of Steve Irwin has survived, look no further than this wild wildlife program from Britain. [Sydney Morning Herald]
The aim … is to pay tribute to, preserve, and perchance replicate that moment where something new—relatively speaking, anyway—becomes worth engaging with and discovering. [SF Weekly]