If it is Optifine you're using of course. If it's actually mods you'll just crash. EDIT : After more research I found that mods are not allowed at all in Realms. And Minecraft did try to add Optifine, but judging by this tweet, Optifine did not want to be part of Minecraft.
In respect to this, how much does it cost to buy a Minecraft realm?
Realms has slightly different pricing plans for different platforms. The cheapest is US$3.99 per month for a server supporting up to 3 simultaneous players (including the owner) on the version that runs on mobile, console and Windows 10. It's $7.99 for a server supporting up to 11 simultaneous players.
How long is the free trial for realms?
For the moment, Realms is only available for the PC (Java) version of Minecraft, though it may see other versions of the game in the future. Anyone who hasn't previously owned a Realm can now sign up for a 30 day trial via the Realms menu in your client.
How do you join a realm in Minecraft?
Joining a player's Realm. From the Minecraft Realms menu within Minecraft, you can view a list of Realms that are available to you. Each Realm that you join first requires an invitation, indicated by the flashing mail icon. Once accepted, that player's Realm will be available to you.