Kěyǐ 可以 ‘may, can, be allowed to’ is a modal verb that always combines with another verb. It is usually used to express possibility and permission. When kěyǐ 可以 is used in an affirmative sentence, it can sometimes be understood as a suggestion.

Structure
Basic form
Like other modal verbs, kěyǐ 可以 is generally placed before the verb it refers to.
Negation
Kěyǐ 可以 can only be negated by the negative adverb bù 不, which must be placed before kěyǐ 可以.
Question
There are two ways of asking questions with kěyǐ 可以. One is to add the question particle ma 吗/嗎 at the end of the sentence.
The other is to use the “modal verb bù 不 modal verb” structure before the verb. In spoken Chinese, a shorter form kě bù kěyǐ 可不可以 is often used.
With adverbs
Adverbs, such as dōu 都 ‘all, both’, are usually placed before kěyǐ 可以.
With verbs preceded by a prepositional phrase
When a verb is preceded by a prepositional phrase, kěyǐ 可以 is placed before this phrase.
Functions
1. kěyǐ 可以 expressing possibility
Similar to néng 能, kěyǐ 可以can also be used to indicate a possibility, as if saying “something is possible due to (circumstantial) conditions”. A sentence with néng 能 emphasizes the possession of an ability, whereas a sentence using kěyǐ 可以 conveys a possibility permitted by (circumstantial) conditions. In English, both meanings are usually translated as ‘can’.
To express the possibility of someone doing something, kěyǐ 可以 can be used. In some contexts, the sentence will be perceived as a suggestion.
This use of kěyǐ 可以 is limited to affirmative and interrogative sentences and cannot be modified by adverbs, which is different from néng 能.
For other usages indicating possibility, check 能
For a comparison with other modal verbs, check comparison 能, 会/會 and 可以
2. kěyǐ 可以 expressing permission
Kěyǐ 可以 is usually used to ask for someone’s permission or to indicate that something is allowed or not allowed. When used in questions, kěyǐ 可以 is interchangeable with another modal verb néng 能. The short answer to such a question is xíng 行 or kěyǐ 可以 ‘yes (you can/you may)’ or bù xíng 不行 ‘No (you can’t)’.
Note that kěyǐ 可以 can be used in a tag question, and néng 能 not.
When using the affirmative form to indicate permission, only kěyǐ 可以 can be used and not néng 能.
The negation form bù kěyǐ 不可以 ‘not allowed’ is used for expressing prohibitions, which is also interchangeable with bù néng 不能 ‘not allowed’. The negation form bù néng 不能 is more formal.
For other usages indicating permission, check 能
For comparison, check comparison 能, 会/會 and 可以