Get random row from custom table

[Note: @marwyk87 posted his answer while I was composing this, which represents another way to fix the problem]

You’ve got a simple syntax error in your SQL, because of the way you’re referencing the table name. You should just say

$sql = $wpdb->prepare( "
    SELECT *
    FROM {$wpdb->prefix}quotes
    ORDER BY RAND()
    LIMIT 1
    ");

and

$sql = $wpdb->prepare( "
    SELECT *
    FROM {$wpdb->prefix}quotes
    WHERE ID = %d
    LIMIT 1
    ", $id );