If you're leasing an apartment, the only person who can evict you is your landlord. If your name is on the lease, your roommate can't throw you out, even if you break the lease in some fashion, such as damaging the apartment or selling drugs out of the living room.
If you and your roommate both have signed the lease, you're both equally liable for it. If one of you leaves, the landlord can ask the other for 100 percent of the rent payment. Likewise, if one of you is caught violating the lease terms, the landlord can legally evict both of you, although he can choose to only evict the guilty party. You're also equally protected by the law: Your landlord can't evict either of you without a reason allowable under state law.
If only one of you is on the lease, the situation is different. The lessee has authority over the "subtenant" similar to a landlord's power. The subtenant must still abide by the landlord's rules, but the lessee can impose his own rules in addition. The lessee also has the right to evict the subtenant. Depending on your state and local law, the lessee may not need the kind of "just cause" reasons for eviction that landlords must have.
Whether you and your roommate are co-tenants or lessee and subtenant, it's helpful to have an agreement spelling out responsibilities and rights. This can include how much rent each of you pays, which rooms you use and rules on noise, overnight guests and cleaning the bathroom, among other things. Breaking the agreement doesn't give one the right to evict each other, but you can go to court or arbitration to settle things.
If you're on the lease and your roommate isn't, it's possible that you can evict him instead of the other way around. If you're both on the lease and he's violating it, you can ask the landlord to evict him. If he resorts to carting your belongings out of the apartment onto the sidewalk, you may have to call the police or file a lawsuit to settle things. This is one reason to write an arbitration policy into your rental agreement, to settle problems before they become unmanageable.