The following is general advice for what to do when you are the subject of an allegation of wrong-doing at university. This advice is general enough to encompass most allegations, including academic wrong-doing that does not rise to the level of formal "academic misconduct", but also including academic misconduct or sexual misconduct. For minor matters this advice can be streamlined and the process is less formal, so you should adapt as required depending on the severity of the matter. I will assume here that the allegation is sufficiently serious that a reasonable degree of formalism and caution is appropriate. For simplicity, most of my answer will assume that we are talking about a public university in a Western country (e.g., the US, England, Australia, etc.). Universities have procedures in place that create an orderly process for determining the nature of the allegation, obtaining relevant evidence, hearing the matter and making a determination. Consequently, the following are some general rules you should follow to deal with the matter.
Rule 1 - Stay calm and don't pre-empt the process
Many questions on Academia.SE concerning accusations of misconduct are written in a tone of panic, asking how the questioner should "prove their innocence" at the outset of an accusation. Often the questions are posted when an accusation is first made, and often the questioner is not even familiar with the specific details of the allegation. Notwithstanding this limited information, questioners often wish to take immediate action to "prove their innocence" in relation to what they speculate to be the details of the allegation or the evidence relating to the matter.
All of that is the wrong thing to do. The first thing to do if you are accused of wrong-doing is to remain calm and remind yourself that there is a process for dealing with misconduct allegations. Public universities are subject to due process requirements for allegations of wrong-doing, and so they are required to operate under the principle that you are "innocent until proven guilty". They are also required to give you written details of the complaint against you, specifying exactly what it is you are alleged to have done, and they must also tell you the evidence against you. (Collecting this evidence may be an ongoing process, so it might not all be present at the start of the allegation anyway.) At the start of the process, you are under no obligation to prove anything. There is no sense in speculating on what it is that you are alleged to have done, or what the evidence of the allegation might be, prior to being given this information in the formal process. Any misconduct process that comports with the requirements of due-process will provide you with a written statement of the allegation against you, and show you the evidence that supports that allegation.
Rule 2 - Read the rules, understand them, and follow the process
When you have been accused of misconduct, you need to read the university rules for the type of misconduct you are accused of, and the procedures for dealing with this. It is advantageous for you to be as familiar with these rules as you can be, so that you know your rights and obligations under those rules. Read all the relevant university policies relating to the process you are involved in, and identify the requirement to provide you with the allegation made against you, and the relevant points where you are given the opportunity to respond to allegations.
Universities should all have misconduct procedures that provide due process to the person accused of wrong-doing. Legal requirements for this differ according to the country and jurisdiction, and whether the university is private or public. (Public universities are generally bound by constitutional rules that are operative on the government. For example, in US public universities, the defendent is generally entitled to notice of the allegations against them and a description of the evidence for those allegations --- see e.g., Dixon v. Alabama State Board of Education 294 F.2d 150.) The most basic requirements of due process are that you are entitled to know the details of the allegation against you and the evidence of those allegations. You are not required to respond to an allegation until you have been supplied with this information and have had a reasonable chance to review and digest it. At some point in the process you will be given an opportunity to submit your own description of events and your own evidence.
Rule 3 - Deal professionally and courteously with the reviewer for the matter
For any kind of formal misconduct matter there will be one or more staff members at the university who act as the reviewer of the matter. This involves invesetigating the matter, making findings of fact from the evidence, and making a determination. Depending on the severity of the matter, for cases of alleged academic misconduct this might be one of the academics in your department (e.g., the Head of Department or some other senior person) or it might be an academic you have not met before, or it might be another staff member in one of the administrative parts of the university. For cases of alleged sexual misconduct the reviewer will usually be one of the administrative staff of the university (e.g., an officer from the "equity" team).
You should deal professionally and courteously with the reviewer and remember that it is their job to investigate the matter and make a determination. Remember that the allegation is not being made by the reviewer, so unless they are acting in an especially unreasonable or biased manner, there is no cause to be upset with them. Likewise, while you may be upset and in need of some validation for yourself (if you are wrongly accused of something) the reviewer is not your therapist or support person. If the reviewer is an academic that you know (e.g., one of your lecturers) then you need to allow them to remain at arms length during the process. Standard rules of professional conduct apply --- maintain a calm and disciplined manner, even if you are upset.
Due process requirements generally require the reviewer of the matter to be unbiased. If the reviewer engages with you in an unreasonably hostile way, or shows other signs of bias, you should make a written note of this (including all relevant details) and you may be able to have the matter assigned to another reviewer. There is little value in getting into an argument with the reviewer --- if you perceive them to be biased then you should document your reasons for this and ask for a new reviewer.
Rule 4 - Do not give your evidence until you are required to do so
A common error when dealing with proceedings for misconduct is for an accused party to rush to head off the allegation by giving information and evidence to the reviewer prior to knowing exactly what they are accused of. Often this occurs due to panic, and due to the (usually misguided) view that the process can be "nipped in the bud" if only you explain yourself immediately. As stated above, due process (and university rules) generally entitles you to be given a written statement setting out the details of the allegation against you, and the evidence for that allegation. In matters that are serious enough for a formal process, always ensure that you do not provide any statement or evidence unless and until you have been provided with this statement. The statement provided to you should clearly state what you are alleged to have done wrong, and the evidence that supports this allegation. If you are still unclear on what you are accused of, seek clarification.
It is not uncommon that you may be "invited" to go and speak to the reviewer at the start of the matter (e.g., when an allegation is first raised) before you have been provided with the full details of the complaint. If you like, this can be used as an opportunity to find out information about the complaint and find out the process for handling the complaint. However, if you are asked to provide a statement or evidence prior to receiving the written statement of complaint (including just "having a chat" about it) you should decline, and tell the relevant officials that you will respond after you have been provided with the statement of complaint against you. If you are called in for a meeting or hearing prior to receiving this statement, you should either decline to attend, or if you decide to attend you should focus on eliciting information about the complaint. If you are asked for your version of events, or your evidence, do not provide any information, and simply state that you will respond after you have had an opportunity to review the written statement of complaint against you. (Also, do not respond contemporaneously in the meeting if they give you this statement; take at least a day or two to review and think about the matter.)
In the event that your university either will not provide you with a written statement of the allegation against you, or expects you to provide pleadings or evidence prior to this, you should generally refuse, and put the university on notice that you expect lawful due-process. If you have read the university rules then you should also be able to cite sections of the rules that entitle you to this information.
Rule 5 - If you are correctly accused, admit what you did and take your punishment
Once you have been provided with the details of the allegation against you, you will be able to determine if it is correct. Notwithstanding the importance of due process, I take the view that if you are accused of some wrong-doing that you have in fact done, you should have the honesty and integrity to admit to that wrong-doing and take the resulting penalty, even if it might not have been proven. This is a good way to develop good character and hold yourself accountable for your actions. Others may take a more legalistic view, but I would recommend this principle.
In some cases the allegation against you will be accurate but there may be some mitigating factors that are not included, and you may wish to draw these to the attention of the reviewer. For example, you might have broken a rule without realising that what you were doing was against the rules. Alternatively there might be some other mitigating factors that you wish to raise. You can make a submission admitting to the wrong-doing you are accused of and also setting out any relevant mitigating factors that you think should be taken account in determining your punishment.
Rule 6 - If you are wrongly accused, use due process protections to protect yourself
If you are accused of something you did not do then you will want to provide a response to the complaint where you set out your own submissions on the issue at hand and your own evidence pertaining to this issue. The details will depend on the particulars of your case. While a university disciplinary process is less formal than a legal proceeding, the same general advice applies. You will want to give a clear and detailed written response, including the strongest evidence you can muster in your favour. This might include statements from other witnesses, emails or other documentary evidence, etc. Try to set our your response in a clear and structured way, make your evidence clear, and avoid repitition unless it is necessary to stress important facts. It is generally a good idea to give your evidence in written form (at least in the first instance), to make sure it is accurate and clear.
University disciplinary processes usually use the "balance of probabilities" or "preponderance of evidence" standard for fact-finding, so although there is some onus of proof on the complainant, it is not usually necessary for the complainant to prove their case "beyond reasonable doubt". In most cases, the outcome of the matter will hinge on the strength of the evidence for the assertions made by the complainant and the respondent. In some university disciplinary processes you may also wish to scrutinise the reviewer to ensure that they are acting in an objective and unbiased way. If you have reason to believe that the reviewer is biased against you, you should ensure that you collect relevant evidence of this and make notes of instances where you were treated with bias.
Rule 7 - Respect the confidentiality of the process (and expect the same from the other parties)
A general rule of disciplinary processes at the university is that there is an expectation of confidentiality, at least until findings are made. Participants in the complaint process are also usually protected from "retaliation".
While circumstances differ depending on the subject of the complaint and the identity of the parties, it is generally a bad idea to contact the complainant outside of the complaint process, since this can be interpreted as an attempt to intimidate or harass the complainant into withdrawal of their complaint. (This is especially so for allegations of sexual misconduct or physical violence; in those cases contact with the complainant should be made only with extreme care.) If you believe you can "clear this up" with the complainant with a simple conversation then you should make this request by email and give them the option of whether or not they wish to meet with you, and the circumstances of your meeting (e.g., do they wish to bring a support person, etc.). Offers to meet with the complainant can also be made through the university reviewer for the matter, though there is no guarantee they will agree to this.
If the complainant or another party breaches the confidentiality of the complaint (e.g., bad-mouthing you around the university) then you should remind the reviewer of your expectation of confidentiality in the process. If the complainant publicly defames you with false allegations then this can also give rise to a cause-of-action for defamation; in this latter event you may wish to seek legal advice.